From 4865d693830f933b2793c73c54e7e7a6f249d9a7 Mon Sep 17 00:00:00 2001 From: Vincent-Core Date: Mon, 30 Jan 2012 14:05:43 +0100 Subject: Core/Script: * Add missing MovementInform handler filters for Icehowl. * Remove UNIT_FLAG_OOC_NOT_ATTACKABLE for Beasts of Northrend. * Fix codestyle for Beasts of Northrend. --- .../TrialOfTheCrusader/boss_northrend_beasts.cpp | 154 +++++++++++---------- .../TrialOfTheCrusader/trial_of_the_crusader.cpp | 8 +- 2 files changed, 84 insertions(+), 78 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 029a7c3c351..1eca7edb590 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -155,15 +155,16 @@ public: ScriptedAI::EnterEvadeMode(); } - void MovementInform(uint32 uiType, uint32 uiId) + void MovementInform(uint32 type, uint32 pointId) { - if (uiType != POINT_MOTION_TYPE) return; + if (type != POINT_MOTION_TYPE) + return; - switch (uiId) + switch (pointId) { case 0: m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); me->SetInCombatWithZone(); break; @@ -215,24 +216,24 @@ public: Summons.Despawn(summon); } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(uint32 const diff) { if (!UpdateVictim()) return; - if (m_uiImpaleTimer <= uiDiff) + if (m_uiImpaleTimer <= diff) { DoCastVictim(SPELL_IMPALE); m_uiImpaleTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS); - } else m_uiImpaleTimer -= uiDiff; + } else m_uiImpaleTimer -= diff; - if (m_uiStaggeringStompTimer <= uiDiff) + if (m_uiStaggeringStompTimer <= diff) { DoCastVictim(SPELL_STAGGERING_STOMP); m_uiStaggeringStompTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS); - } else m_uiStaggeringStompTimer -= uiDiff; + } else m_uiStaggeringStompTimer -= diff; - if (m_uiSummonTimer <= uiDiff) + if (m_uiSummonTimer <= diff) { if (m_uiSummonCount > 0) { @@ -240,7 +241,7 @@ public: DoScriptText(SAY_SNOBOLLED, me); } m_uiSummonTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiSummonTimer -= uiDiff; + } else m_uiSummonTimer -= diff; DoMeleeAttackIfReady(); } @@ -286,7 +287,7 @@ public: if (m_instance) m_uiBossGUID = m_instance->GetData64(NPC_GORMOK); //Workaround for Snobold - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); } void EnterEvadeMode() @@ -308,11 +309,12 @@ public: uiDamage = 0; } - void MovementInform(uint32 uiType, uint32 uiId) + void MovementInform(uint32 type, uint32 pointId) { - if (uiType != POINT_MOTION_TYPE) return; + if (type != POINT_MOTION_TYPE) + return; - switch (uiId) + switch (pointId) { case 0: if (m_bTargetDied) @@ -330,7 +332,7 @@ public: m_instance->SetData(DATA_SNOBOLD_COUNT, DECREASE); } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(uint32 const diff) { if (m_bTargetDied || !UpdateVictim()) return; @@ -357,29 +359,29 @@ public: } } - if (m_uiFireBombTimer < uiDiff) + if (m_uiFireBombTimer < diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_FIRE_BOMB); m_uiFireBombTimer = 20000; } - else m_uiFireBombTimer -= uiDiff; + else m_uiFireBombTimer -= diff; - if (m_uiBatterTimer < uiDiff) + if (m_uiBatterTimer < diff) { if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID)) DoCast(target, SPELL_BATTER); m_uiBatterTimer = 10000; } - else m_uiBatterTimer -= uiDiff; + else m_uiBatterTimer -= diff; - if (m_uiHeadCrackTimer < uiDiff) + if (m_uiHeadCrackTimer < diff) { if (Unit* target = Unit::GetPlayer(*me, m_uiTargetGUID)) DoCast(target, SPELL_HEAD_CRACK); m_uiHeadCrackTimer = 35000; } - else m_uiHeadCrackTimer -= uiDiff; + else m_uiHeadCrackTimer -= diff; DoMeleeAttackIfReady(); } @@ -450,7 +452,7 @@ struct boss_jormungarAI : public ScriptedAI instanceScript->SetData(TYPE_NORTHREND_BEASTS, SNAKES_IN_PROGRESS); } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(uint32 const diff) { if (!UpdateVictim()) return; @@ -458,7 +460,7 @@ struct boss_jormungarAI : public ScriptedAI { DoScriptText(SAY_EMERGE, me); me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); DoCast(SPELL_ENRAGE); enraged = true; DoScriptText(SAY_BERSERK, me); @@ -478,98 +480,98 @@ struct boss_jormungarAI : public ScriptedAI switch (stage) { case 0: // Mobile - if (biteTimer <= uiDiff) + if (biteTimer <= diff) { DoCastVictim(biteSpell); biteTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else biteTimer -= uiDiff; + } else biteTimer -= diff; - if (spewTimer <= uiDiff) + if (spewTimer <= diff) { DoCastAOE(spewSpell); spewTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else spewTimer -= uiDiff; + } else spewTimer -= diff; - if (slimePoolTimer <= uiDiff) + if (slimePoolTimer <= diff) { /* Spell summon has only 30s duration */ DoCast(me, SUMMON_SLIME_POOL); slimePoolTimer = 30*IN_MILLISECONDS; - } else slimePoolTimer -= uiDiff; + } else slimePoolTimer -= diff; - if (submergeTimer <= uiDiff && !enraged) + if (submergeTimer <= diff && !enraged) { stage = 1; submergeTimer = 5*IN_MILLISECONDS; - } else submergeTimer -= uiDiff; + } else submergeTimer -= diff; DoMeleeAttackIfReady(); break; case 1: // Submerge - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); DoCast(me, SPELL_SUBMERGE_0); DoScriptText(SAY_SUBMERGE, me); - me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX()+urand(0, 80)-40, ToCCommonLoc[1].GetPositionY()+urand(0, 80)-40, ToCCommonLoc[1].GetPositionZ()); + me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX()+ frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ()); stage = 2; case 2: // Wait til emerge - if (submergeTimer <= uiDiff) + if (submergeTimer <= diff) { stage = 3; submergeTimer = 50*IN_MILLISECONDS; - } else submergeTimer -= uiDiff; + } else submergeTimer -= diff; break; case 3: // Emerge me->SetDisplayId(modelStationary); DoScriptText(SAY_EMERGE, me); me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); DoCast(me, SPELL_EMERGE_0); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); SetCombatMovement(false); me->GetMotionMaster()->MoveIdle(); stage = 4; break; case 4: // Stationary - if (sprayTimer <= uiDiff) + if (sprayTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, spraySpell); sprayTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else sprayTimer -= uiDiff; + } else sprayTimer -= diff; - if (sweepTimer <= uiDiff) + if (sweepTimer <= diff) { DoCastAOE(SPELL_SWEEP_0); sweepTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else sweepTimer -= uiDiff; + } else sweepTimer -= diff; - if (submergeTimer <= uiDiff) + if (submergeTimer <= diff) { stage = 5; submergeTimer = 10*IN_MILLISECONDS; - } else submergeTimer -= uiDiff; + } else submergeTimer -= diff; DoSpellAttackIfReady(spitSpell); break; case 5: // Submerge - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); DoCast(me, SPELL_SUBMERGE_0); DoScriptText(SAY_SUBMERGE, me); - me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX()+urand(0, 80)-40, ToCCommonLoc[1].GetPositionY()+urand(0, 80)-40, ToCCommonLoc[1].GetPositionZ()); + me->GetMotionMaster()->MovePoint(0, ToCCommonLoc[1].GetPositionX() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionY() + frand(-40.0f, 40.0f), ToCCommonLoc[1].GetPositionZ()); stage = 6; case 6: // Wait til emerge - if (submergeTimer <= uiDiff) + if (submergeTimer <= diff) { stage = 7; submergeTimer = 45*IN_MILLISECONDS; - } else submergeTimer -= uiDiff; + } else submergeTimer -= diff; break; case 7: // Emerge me->SetDisplayId(modelMobile); DoScriptText(SAY_EMERGE, me); me->RemoveAurasDueToSpell(SPELL_SUBMERGE_0); DoCast(me, SPELL_EMERGE_0); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); SetCombatMovement(true); me->GetMotionMaster()->MoveChase(me->getVictim()); @@ -662,20 +664,21 @@ public: stage = 0; } - void MovementInform(uint32 uiType, uint32 uiId) + void MovementInform(uint32 type, uint32 pointId) { - if (uiType != POINT_MOTION_TYPE) return; + if (type != POINT_MOTION_TYPE) + return; - switch (uiId) + switch (pointId) { case 0: instanceScript->DoUseDoorOrButton(instanceScript->GetData64(GO_MAIN_GATE_DOOR)); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); me->SetInCombatWithZone(); if (Creature* otherWorm = Unit::GetCreature(*me, instanceScript->GetData64(otherWormEntry))) { - otherWorm->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + otherWorm->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); otherWorm->SetReactState(REACT_AGGRESSIVE); otherWorm->SetVisible(true); otherWorm->SetInCombatWithZone(); @@ -728,7 +731,7 @@ public: me->SetReactState(REACT_PASSIVE); } - void UpdateAI(const uint32 /*uiDiff*/) + void UpdateAI(uint32 const /*diff*/) { if (!casted) { @@ -795,11 +798,12 @@ public: m_instance->SetData(TYPE_NORTHREND_BEASTS, ICEHOWL_DONE); } - void MovementInform(uint32 uiType, uint32 uiId) + void MovementInform(uint32 type, uint32 pointId) { - if (uiType != POINT_MOTION_TYPE) return; + if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE) + return; - switch (uiId) + switch (pointId) { case 0: if (me->GetDistance2d(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY()) < 6.0f) @@ -813,7 +817,9 @@ public: if (Unit::GetPlayer(*me, m_uiTrampleTargetGUID)) { m_uiStage = 4; - } else m_uiStage = 6; + } + else + m_uiStage = 6; } break; case 1: // Finish trample @@ -821,7 +827,7 @@ public: break; case 2: m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); me->SetInCombatWithZone(); break; @@ -860,7 +866,7 @@ public: me->SetInCombatWithZone(); } - void SpellHitTarget(Unit* target, const SpellInfo* spell) + void SpellHitTarget(Unit* target, SpellInfo const* spell) { if (spell->Id == SPELL_TRAMPLE && target->GetTypeId() == TYPEID_PLAYER) { @@ -872,7 +878,7 @@ public: } } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(uint32 const diff) { if (!UpdateVictim()) return; @@ -880,31 +886,31 @@ public: switch (m_uiStage) { case 0: - if (m_uiFerociousButtTimer <= uiDiff) + if (m_uiFerociousButtTimer <= diff) { DoCastVictim(SPELL_FEROCIOUS_BUTT); m_uiFerociousButtTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiFerociousButtTimer -= uiDiff; + } else m_uiFerociousButtTimer -= diff; - if (m_uiArticBreathTimer <= uiDiff) + if (m_uiArticBreathTimer <= diff) { if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_ARCTIC_BREATH); m_uiArticBreathTimer = urand(25*IN_MILLISECONDS, 40*IN_MILLISECONDS); - } else m_uiArticBreathTimer -= uiDiff; + } else m_uiArticBreathTimer -= diff; - if (m_uiWhirlTimer <= uiDiff) + if (m_uiWhirlTimer <= diff) { DoCastAOE(SPELL_WHIRL); m_uiWhirlTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); - } else m_uiWhirlTimer -= uiDiff; + } else m_uiWhirlTimer -= diff; - if (m_uiMassiveCrashTimer <= uiDiff) + if (m_uiMassiveCrashTimer <= diff) { me->GetMotionMaster()->MoveJump(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 10.0f, 20.0f); // 1: Middle of the room m_uiStage = 7; //Invalid (Do nothing more than move) m_uiMassiveCrashTimer = 30*IN_MILLISECONDS; - } else m_uiMassiveCrashTimer -= uiDiff; + } else m_uiMassiveCrashTimer -= diff; DoMeleeAttackIfReady(); break; @@ -927,7 +933,7 @@ public: } else m_uiStage = 6; break; case 3: - if (m_uiTrampleTimer <= uiDiff) + if (m_uiTrampleTimer <= diff) { if (Unit* target = Unit::GetPlayer(*me, m_uiTrampleTargetGUID)) { @@ -942,7 +948,7 @@ public: 10.0f, 20.0f); // 2: Hop Backwards m_uiStage = 7; //Invalid (Do nothing more than move) } else m_uiStage = 6; - } else m_uiTrampleTimer -= uiDiff; + } else m_uiTrampleTimer -= diff; break; case 4: DoScriptText(SAY_TRAMPLE_START, me); @@ -953,12 +959,12 @@ public: case 5: if (m_bMovementFinish) { - if (m_uiTrampleTimer <= uiDiff) DoCastAOE(SPELL_TRAMPLE); + if (m_uiTrampleTimer <= diff) DoCastAOE(SPELL_TRAMPLE); m_bMovementFinish = false; m_uiStage = 6; return; } - if (m_uiTrampleTimer <= uiDiff) + if (m_uiTrampleTimer <= diff) { Map::PlayerList const &lPlayers = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr) @@ -971,7 +977,7 @@ public: break; } } - } else m_uiTrampleTimer -= uiDiff; + } else m_uiTrampleTimer -= diff; break; case 6: if (!m_bTrampleCasted) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index 7412d75c97b..b17b6f1286b 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -563,7 +563,7 @@ class npc_tirion_toc : public CreatureScript if (Creature* temp = me->SummonCreature(NPC_GORMOK, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30*IN_MILLISECONDS)) { temp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ()); - temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); temp->SetReactState(REACT_PASSIVE); } } @@ -591,13 +591,13 @@ class npc_tirion_toc : public CreatureScript if (Creature* temp = me->SummonCreature(NPC_DREADSCALE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN)) { temp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[8].GetPositionX(), ToCCommonLoc[8].GetPositionY(), ToCCommonLoc[8].GetPositionZ()); - temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); temp->SetReactState(REACT_PASSIVE); } if (Creature* temp = me->SummonCreature(NPC_ACIDMAW, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN)) { temp->SetVisible(true); - temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); temp->SetReactState(REACT_PASSIVE); } } @@ -623,7 +623,7 @@ class npc_tirion_toc : public CreatureScript if (Creature* temp = me->SummonCreature(NPC_ICEHOWL, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_DEAD_DESPAWN)) { temp->GetMotionMaster()->MovePoint(2, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ()); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); } -- cgit v1.2.3 From 9d64dc1799fe5109c19b3d7f35cacc8a9a47ed7f Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 31 Jan 2012 14:09:08 +0100 Subject: Scripts/Icecrown Citaldel: Fixed Bone Slice being used during first 10 seconds of the encounter after a wipe Closes #5020 --- src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index 04ae6f933d8..ac246abdc7c 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -106,6 +106,7 @@ class boss_lord_marrowgar : public CreatureScript events.ScheduleEvent(EVENT_COLDFLAME, 5000, EVENT_GROUP_SPECIAL); events.ScheduleEvent(EVENT_WARN_BONE_STORM, urand(45000, 50000)); events.ScheduleEvent(EVENT_ENRAGE, 600000); + _boneSlice = false; } void EnterCombat(Unit* /*who*/) -- cgit v1.2.3 From 08be716ef8a53a239ca4b2dc1df37dc9c65e8892 Mon Sep 17 00:00:00 2001 From: Shocker Date: Fri, 3 Feb 2012 19:02:17 +0200 Subject: Core/Misc: Rename UNIT_STAT_* enums to UNIT_STATE_* --- src/server/game/AI/CoreAI/CombatAI.cpp | 4 +- src/server/game/AI/CoreAI/PassiveAI.cpp | 8 +- src/server/game/AI/CoreAI/PetAI.cpp | 4 +- src/server/game/AI/CoreAI/UnitAI.cpp | 4 +- src/server/game/AI/CreatureAIImpl.h | 4 +- src/server/game/AI/EventAI/CreatureEventAI.cpp | 4 +- src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 4 +- src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 2 +- .../game/AI/ScriptedAI/ScriptedFollowerAI.cpp | 14 +-- src/server/game/AI/SmartScripts/SmartScript.cpp | 2 +- src/server/game/Combat/ThreatManager.cpp | 2 +- src/server/game/DungeonFinding/LFGMgr.cpp | 2 +- src/server/game/Entities/Creature/Creature.cpp | 6 +- src/server/game/Entities/Creature/Creature.h | 2 +- src/server/game/Entities/Object/Object.cpp | 2 +- src/server/game/Entities/Player/Player.cpp | 8 +- src/server/game/Entities/Player/Player.h | 2 +- src/server/game/Entities/Unit/Unit.cpp | 110 ++++++++++----------- src/server/game/Entities/Unit/Unit.h | 88 ++++++++--------- src/server/game/Entities/Vehicle/Vehicle.cpp | 8 +- src/server/game/Grids/Notifiers/GridNotifiers.cpp | 2 +- src/server/game/Grids/Notifiers/GridNotifiers.h | 2 +- src/server/game/Handlers/AuctionHouseHandler.cpp | 14 +-- src/server/game/Handlers/CharacterHandler.cpp | 2 +- src/server/game/Handlers/ChatHandler.cpp | 4 +- src/server/game/Handlers/GuildHandler.cpp | 2 +- src/server/game/Handlers/ItemHandler.cpp | 8 +- src/server/game/Handlers/MiscHandler.cpp | 2 +- src/server/game/Handlers/NPCHandler.cpp | 28 +++--- src/server/game/Handlers/PetHandler.cpp | 4 +- src/server/game/Handlers/PetitionsHandler.cpp | 2 +- src/server/game/Handlers/QuestHandler.cpp | 2 +- src/server/game/Handlers/SkillHandler.cpp | 2 +- src/server/game/Handlers/TaxiHandler.cpp | 4 +- src/server/game/Handlers/TradeHandler.cpp | 4 +- src/server/game/Movement/MotionMaster.cpp | 6 +- .../ConfusedMovementGenerator.cpp | 14 +-- .../FleeingMovementGenerator.cpp | 20 ++-- .../MovementGenerators/HomeMovementGenerator.cpp | 8 +- .../MovementGenerators/IdleMovementGenerator.cpp | 14 +-- .../MovementGenerators/PointMovementGenerator.cpp | 14 +-- .../MovementGenerators/RandomMovementGenerator.cpp | 10 +- .../TargetedMovementGenerator.cpp | 16 +-- .../MovementGenerators/TargetedMovementGenerator.h | 8 +- .../WaypointMovementGenerator.cpp | 18 ++-- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 36 +++---- src/server/game/Spells/Auras/SpellAuras.cpp | 2 +- src/server/game/Spells/Spell.cpp | 16 +-- src/server/game/Spells/SpellEffects.cpp | 8 +- src/server/game/Spells/SpellInfo.cpp | 2 +- .../BlackrockSpire/boss_drakkisath.cpp | 2 +- .../EasternKingdoms/BlackrockSpire/boss_gyth.cpp | 2 +- .../BlackrockSpire/boss_halycon.cpp | 2 +- .../BlackrockSpire/boss_highlord_omokk.cpp | 2 +- .../BlackrockSpire/boss_mother_smolderweb.cpp | 2 +- .../BlackrockSpire/boss_overlord_wyrmthalak.cpp | 2 +- .../BlackrockSpire/boss_pyroguard_emberseer.cpp | 2 +- .../BlackrockSpire/boss_quartermaster_zigris.cpp | 2 +- .../BlackrockSpire/boss_rend_blackhand.cpp | 2 +- .../boss_shadow_hunter_voshgajin.cpp | 2 +- .../BlackrockSpire/boss_the_beast.cpp | 2 +- .../BlackrockSpire/boss_warmaster_voone.cpp | 2 +- .../BlackwingLair/boss_victor_nefarius.cpp | 2 +- .../Karazhan/boss_prince_malchezaar.cpp | 2 +- .../MoltenCore/boss_baron_geddon.cpp | 2 +- .../EasternKingdoms/MoltenCore/boss_garr.cpp | 2 +- .../EasternKingdoms/MoltenCore/boss_gehennas.cpp | 2 +- .../EasternKingdoms/MoltenCore/boss_golemagg.cpp | 2 +- .../EasternKingdoms/MoltenCore/boss_lucifron.cpp | 2 +- .../EasternKingdoms/MoltenCore/boss_magmadar.cpp | 2 +- .../MoltenCore/boss_majordomo_executus.cpp | 2 +- .../EasternKingdoms/MoltenCore/boss_shazzrah.cpp | 2 +- .../MoltenCore/boss_sulfuron_harbinger.cpp | 4 +- .../SunwellPlateau/boss_kiljaeden.cpp | 2 +- .../EasternKingdoms/SunwellPlateau/boss_muru.cpp | 12 +-- .../EasternKingdoms/ZulGurub/boss_venoxis.cpp | 2 +- .../Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp | 2 +- .../scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp | 2 +- .../Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp | 2 +- .../TempleOfAhnQiraj/boss_twinemperors.cpp | 10 +- .../AzjolNerub/Ahnkahet/boss_herald_volazj.cpp | 6 +- .../AzjolNerub/AzjolNerub/boss_anubarak.cpp | 2 +- .../RubySanctum/boss_baltharus_the_warborn.cpp | 4 +- .../RubySanctum/boss_general_zarithrian.cpp | 4 +- .../RubySanctum/boss_saviana_ragefire.cpp | 2 +- .../TrialOfTheChampion/boss_black_knight.cpp | 12 +-- .../FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp | 2 +- .../ForgeOfSouls/boss_devourer_of_souls.cpp | 2 +- .../FrozenHalls/ForgeOfSouls/forge_of_souls.cpp | 16 +-- .../FrozenHalls/HallsOfReflection/boss_falric.cpp | 2 +- .../FrozenHalls/HallsOfReflection/boss_marwyn.cpp | 2 +- .../HallsOfReflection/halls_of_reflection.cpp | 10 +- .../PitOfSaron/boss_forgemaster_garfrost.cpp | 2 +- .../FrozenHalls/PitOfSaron/boss_krickandick.cpp | 2 +- .../FrozenHalls/PitOfSaron/pit_of_saron.cpp | 4 +- .../Northrend/Gundrak/boss_drakkari_colossus.cpp | 6 +- .../scripts/Northrend/Gundrak/boss_gal_darah.cpp | 8 +- .../IcecrownCitadel/boss_blood_prince_council.cpp | 16 +-- .../IcecrownCitadel/boss_blood_queen_lana_thel.cpp | 2 +- .../IcecrownCitadel/boss_deathbringer_saurfang.cpp | 2 +- .../Northrend/IcecrownCitadel/boss_festergut.cpp | 4 +- .../IcecrownCitadel/boss_lady_deathwhisper.cpp | 8 +- .../IcecrownCitadel/boss_lord_marrowgar.cpp | 2 +- .../IcecrownCitadel/boss_professor_putricide.cpp | 4 +- .../Northrend/IcecrownCitadel/boss_rotface.cpp | 4 +- .../Northrend/IcecrownCitadel/boss_sindragosa.cpp | 8 +- .../IcecrownCitadel/boss_the_lich_king.cpp | 22 ++--- .../IcecrownCitadel/boss_valithria_dreamwalker.cpp | 12 +-- .../Northrend/IcecrownCitadel/icecrown_citadel.cpp | 14 +-- .../scripts/Northrend/Naxxramas/boss_faerlina.cpp | 2 +- .../Northrend/Naxxramas/boss_four_horsemen.cpp | 2 +- .../scripts/Northrend/Naxxramas/boss_gothik.cpp | 2 +- .../scripts/Northrend/Naxxramas/boss_kelthuzad.cpp | 2 +- .../scripts/Northrend/Naxxramas/boss_thaddius.cpp | 2 +- .../Northrend/Nexus/EyeOfEternity/boss_malygos.cpp | 2 +- .../scripts/Northrend/Nexus/Oculus/boss_drakos.cpp | 2 +- .../scripts/Northrend/Nexus/Oculus/boss_eregos.cpp | 2 +- .../scripts/Northrend/Nexus/Oculus/boss_varos.cpp | 2 +- .../Ulduar/Ulduar/boss_assembly_of_iron.cpp | 6 +- .../Northrend/Ulduar/Ulduar/boss_auriaya.cpp | 6 +- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 6 +- .../scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp | 8 +- .../Northrend/Ulduar/Ulduar/boss_general_vezax.cpp | 4 +- .../scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp | 20 ++-- .../scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp | 2 +- .../Northrend/Ulduar/Ulduar/boss_kologarn.cpp | 4 +- .../scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp | 2 +- .../UtgardeKeep/boss_ingvar_the_plunderer.cpp | 2 +- .../UtgardeKeep/UtgardeKeep/boss_keleseth.cpp | 2 +- .../UtgardeKeep/UtgardePinnacle/boss_svala.cpp | 4 +- .../Northrend/VaultOfArchavon/boss_archavon.cpp | 4 +- .../Northrend/VaultOfArchavon/boss_emalon.cpp | 4 +- .../Northrend/VaultOfArchavon/boss_koralon.cpp | 2 +- .../Northrend/VaultOfArchavon/boss_toravon.cpp | 4 +- src/server/scripts/Northrend/borean_tundra.cpp | 6 +- .../boss_shirrak_the_dead_watcher.cpp | 2 +- .../HellfireRamparts/boss_vazruden_the_herald.cpp | 4 +- .../MagtheridonsLair/boss_magtheridon.cpp | 8 +- .../instance_magtheridons_lair.cpp | 2 +- .../Outland/TempestKeep/Eye/boss_kaelthas.cpp | 2 +- .../scripts/Outland/boss_doomlord_kazzak.cpp | 2 +- src/server/scripts/Outland/boss_doomwalker.cpp | 2 +- src/server/scripts/Outland/nagrand.cpp | 2 +- src/server/scripts/Outland/netherstorm.cpp | 2 +- src/server/scripts/Outland/shadowmoon_valley.cpp | 4 +- src/server/scripts/Spells/spell_quest.cpp | 2 +- src/server/scripts/World/boss_emerald_dragons.cpp | 2 +- src/server/scripts/World/npcs_special.cpp | 10 +- 148 files changed, 483 insertions(+), 483 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp index a83fb6f2789..e178efc7eee 100755 --- a/src/server/game/AI/CoreAI/CombatAI.cpp +++ b/src/server/game/AI/CoreAI/CombatAI.cpp @@ -99,7 +99,7 @@ void CombatAI::UpdateAI(const uint32 diff) events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (uint32 spellId = events.ExecuteEvent()) @@ -158,7 +158,7 @@ void CasterAI::UpdateAI(const uint32 diff) events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (uint32 spellId = events.ExecuteEvent()) diff --git a/src/server/game/AI/CoreAI/PassiveAI.cpp b/src/server/game/AI/CoreAI/PassiveAI.cpp index 1244e032dbd..3738d5bab6c 100755 --- a/src/server/game/AI/CoreAI/PassiveAI.cpp +++ b/src/server/game/AI/CoreAI/PassiveAI.cpp @@ -61,14 +61,14 @@ void PossessedAI::KilledUnit(Unit* victim) void CritterAI::DamageTaken(Unit* /*done_by*/, uint32&) { - if (!me->HasUnitState(UNIT_STAT_FLEEING)) - me->SetControlled(true, UNIT_STAT_FLEEING); + if (!me->HasUnitState(UNIT_STATE_FLEEING)) + me->SetControlled(true, UNIT_STATE_FLEEING); } void CritterAI::EnterEvadeMode() { - if (me->HasUnitState(UNIT_STAT_FLEEING)) - me->SetControlled(false, UNIT_STAT_FLEEING); + if (me->HasUnitState(UNIT_STATE_FLEEING)) + me->SetControlled(false, UNIT_STATE_FLEEING); CreatureAI::EnterEvadeMode(); } diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 015e20415b1..83a89a966c5 100755 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -116,14 +116,14 @@ void PetAI::UpdateAI(const uint32 diff) else HandleReturnMovement(); } - else if (owner && !me->HasUnitState(UNIT_STAT_FOLLOW)) // no charm info and no victim + else if (owner && !me->HasUnitState(UNIT_STATE_FOLLOW)) // no charm info and no victim me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle()); if (!me->GetCharmInfo()) return; // Autocast (casted only in combat or persistent spells in any state) - if (!me->HasUnitState(UNIT_STAT_CASTING)) + if (!me->HasUnitState(UNIT_STATE_CASTING)) { typedef std::vector > TargetSpellList; TargetSpellList targetSpellStore; diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index 38504b90b19..bf50909eeee 100755 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -40,7 +40,7 @@ void UnitAI::AttackStartCaster(Unit* victim, float dist) void UnitAI::DoMeleeAttackIfReady() { - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; Unit* victim = me->getVictim(); @@ -60,7 +60,7 @@ void UnitAI::DoMeleeAttackIfReady() bool UnitAI::DoSpellAttackIfReady(uint32 spell) { - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return true; if (me->isAttackReady()) diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h index 147e829b0df..f568da80b49 100755 --- a/src/server/game/AI/CreatureAIImpl.h +++ b/src/server/game/AI/CreatureAIImpl.h @@ -596,7 +596,7 @@ inline bool CreatureAI::_EnterEvadeMode() inline void UnitAI::DoCast(Unit* victim, uint32 spellId, bool triggered) { - if (!victim || (me->HasUnitState(UNIT_STAT_CASTING) && !triggered)) + if (!victim || (me->HasUnitState(UNIT_STATE_CASTING) && !triggered)) return; me->CastSpell(victim, spellId, triggered); @@ -609,7 +609,7 @@ inline void UnitAI::DoCastVictim(uint32 spellId, bool triggered) inline void UnitAI::DoCastAOE(uint32 spellId, bool triggered) { - if (!triggered && me->HasUnitState(UNIT_STAT_CASTING)) + if (!triggered && me->HasUnitState(UNIT_STATE_CASTING)) return; me->CastSpell((Unit*)NULL, spellId, triggered); diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp index c507262bd3f..5db9d0b1cdb 100755 --- a/src/server/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp @@ -577,7 +577,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 { if (action.combat_movement.melee) { - me->AddUnitState(UNIT_STAT_MELEE_ATTACKING); + me->AddUnitState(UNIT_STATE_MELEE_ATTACKING); me->SendMeleeAttackStart(victim); } if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE) @@ -591,7 +591,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 Unit* victim = me->getVictim(); if (action.combat_movement.melee && victim) { - me->ClearUnitState(UNIT_STAT_MELEE_ATTACKING); + me->ClearUnitState(UNIT_STATE_MELEE_ATTACKING); me->SendMeleeAttackStop(victim); } if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE) diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 1b6fde6d132..bd6c901f99c 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -595,7 +595,7 @@ void BossAI::UpdateAI(uint32 const diff) events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -654,7 +654,7 @@ void WorldBossAI::UpdateAI(uint32 const diff) events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index c5f04d4ff5f..048cc8b3d68 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -90,7 +90,7 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* who) void npc_escortAI::MoveInLineOfSight(Unit* who) { - if (!me->HasUnitState(UNIT_STAT_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me)) + if (!me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me)) { if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(who)) return; diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index 53747d0c799..d83ad9b756c 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -38,8 +38,8 @@ void FollowerAI::AttackStart(Unit* who) me->SetInCombatWith(who); who->SetInCombatWith(me); - if (me->HasUnitState(UNIT_STAT_FOLLOW)) - me->ClearUnitState(UNIT_STAT_FOLLOW); + if (me->HasUnitState(UNIT_STATE_FOLLOW)) + me->ClearUnitState(UNIT_STATE_FOLLOW); if (IsCombatMovementAllowed()) me->GetMotionMaster()->MoveChase(who); @@ -88,7 +88,7 @@ bool FollowerAI::AssistPlayerInCombat(Unit* who) void FollowerAI::MoveInLineOfSight(Unit* who) { - if (!me->HasUnitState(UNIT_STAT_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me)) + if (!me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me)) { if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(who)) return; @@ -340,9 +340,9 @@ Player* FollowerAI::GetLeaderForFollower() void FollowerAI::SetFollowComplete(bool bWithEndEvent) { - if (me->HasUnitState(UNIT_STAT_FOLLOW)) + if (me->HasUnitState(UNIT_STATE_FOLLOW)) { - me->ClearUnitState(UNIT_STAT_FOLLOW); + me->ClearUnitState(UNIT_STATE_FOLLOW); me->StopMoving(); me->GetMotionMaster()->Clear(); @@ -369,9 +369,9 @@ void FollowerAI::SetFollowPaused(bool paused) { AddFollowState(STATE_FOLLOW_PAUSED); - if (me->HasUnitState(UNIT_STAT_FOLLOW)) + if (me->HasUnitState(UNIT_STATE_FOLLOW)) { - me->ClearUnitState(UNIT_STAT_FOLLOW); + me->ClearUnitState(UNIT_STATE_FOLLOW); me->StopMoving(); me->GetMotionMaster()->Clear(); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 2b32946da17..a6923ea19e0 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2718,7 +2718,7 @@ void SmartScript::UpdateTimer(SmartScriptHolder& e, uint32 const diff) { if (!(e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS)) { - if (me && me->HasUnitState(UNIT_STAT_CASTING)) + if (me && me->HasUnitState(UNIT_STATE_CASTING)) { e.timer = 1; return; diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 7833198e3c3..d82e43ba83b 100755 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -180,7 +180,7 @@ void HostileReference::updateOnlineStatus() // target is not in flight if (isValid() && (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->isGameMaster()) - && !getTarget()->HasUnitState(UNIT_STAT_IN_FLIGHT) + && !getTarget()->HasUnitState(UNIT_STATE_IN_FLIGHT) && getTarget()->IsInMap(getSourceUnit()) ) { diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index ac7343e8f23..cccb780e412 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1762,7 +1762,7 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false* error = LFG_TELEPORTERROR_INVALID_LOCATION; else if (!player->isAlive()) error = LFG_TELEPORTERROR_PLAYER_DEAD; - else if (player->IsFalling() || player->HasUnitState(UNIT_STAT_JUMPING)) + else if (player->IsFalling() || player->HasUnitState(UNIT_STATE_JUMPING)) error = LFG_TELEPORTERROR_FALLING; else { diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 23865dd9e41..d29fb5bdad6 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -685,7 +685,7 @@ void Creature::DoFleeToGetAssistance() if (!creature) //SetFeared(true, getVictim()->GetGUID(), 0, sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY)); //TODO: use 31365 - SetControlled(true, UNIT_STAT_FLEEING); + SetControlled(true, UNIT_STATE_FLEEING); else GetMotionMaster()->MoveSeekAssistance(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ()); } @@ -1536,7 +1536,7 @@ void Creature::setDeathState(DeathState s) if (GetCreatureInfo()->InhabitType & INHABIT_WATER) AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING); SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag); - ClearUnitState(uint32(UNIT_STAT_ALL_STATE)); + ClearUnitState(uint32(UNIT_STATE_ALL_STATE)); SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool)); LoadCreaturesAddon(true); Motion_Initialize(); @@ -1947,7 +1947,7 @@ bool Creature::_IsTargetAcceptable(const Unit* target) const || (m_vehicle && (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target)))) return false; - if (target->HasUnitState(UNIT_STAT_DIED)) + if (target->HasUnitState(UNIT_STATE_DIED)) { // guards can detect fake death if (isGuard() && target->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH)) diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 05339f1da53..e622c48761c 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -512,7 +512,7 @@ class Creature : public Unit, public GridObject, public MapCreature uint8 getLevelForTarget(WorldObject const* target) const; // overwrite Unit::getLevelForTarget for boss level support - bool IsInEvadeMode() const { return HasUnitState(UNIT_STAT_EVADE); } + bool IsInEvadeMode() const { return HasUnitState(UNIT_STATE_EVADE); } bool AIM_Initialize(CreatureAI* ai = NULL); void Motion_Initialize(); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 732171da67a..1a8eb8f82e2 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2458,7 +2458,7 @@ namespace Trinity float x, y, z; - if (!c->isAlive() || c->HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) || + if (!c->isAlive() || c->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED) || !c->GetMotionMaster()->GetDestination(x, y, z)) { x = c->GetPositionX(); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 83ea7f4ed03..697e225815a 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1589,7 +1589,7 @@ void Player::Update(uint32 p_time) GetAchievementMgr().UpdateTimedAchievements(p_time); - if (HasUnitState(UNIT_STAT_MELEE_ATTACKING) && !HasUnitState(UNIT_STAT_CASTING)) + if (HasUnitState(UNIT_STATE_MELEE_ATTACKING) && !HasUnitState(UNIT_STATE_CASTING)) { if (Unit* pVictim = getVictim()) { @@ -11385,7 +11385,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool { // May be here should be more stronger checks; STUNNED checked // ROOT, CONFUSED, DISTRACTED, FLEEING this needs to be checked. - if (HasUnitState(UNIT_STAT_STUNNED)) + if (HasUnitState(UNIT_STATE_STUNNED)) return EQUIP_ERR_YOU_ARE_STUNNED; // do not allow equipping gear except weapons, offhands, projectiles, relics in @@ -20265,7 +20265,7 @@ bool Player::ActivateTaxiPathTo(std::vector const& nodes, Creature* npc return false; // not let cheating with start flight in time of logout process || while in combat || has type state: stunned || has type state: root - if (GetSession()->isLogingOut() || isInCombat() || HasUnitState(UNIT_STAT_STUNNED) || HasUnitState(UNIT_STAT_ROOT)) + if (GetSession()->isLogingOut() || isInCombat() || HasUnitState(UNIT_STATE_STUNNED) || HasUnitState(UNIT_STATE_ROOT)) { WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); data << uint32(ERR_TAXIPLAYERBUSY); @@ -21560,7 +21560,7 @@ void Player::SendInitialVisiblePackets(Unit* target) SendAurasForTarget(target); if (target->isAlive()) { - if (target->HasUnitState(UNIT_STAT_MELEE_ATTACKING) && target->getVictim()) + if (target->HasUnitState(UNIT_STATE_MELEE_ATTACKING) && target->getVictim()) target->SendMeleeAttackStart(target->getVictim()); } } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 2fa171cf3f9..489b4eacec5 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1806,7 +1806,7 @@ class Player : public Unit, public GridObject void SetContestedPvPTimer(uint32 newTime) {m_contestedPvPTimer = newTime;} void ResetContestedPvP() { - ClearUnitState(UNIT_STAT_ATTACK_PLAYER); + ClearUnitState(UNIT_STATE_ATTACK_PLAYER); RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP); m_contestedPvPTimer = 0; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 289a600e88a..a513c1dd929 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -316,7 +316,7 @@ void Unit::Update(uint32 p_time) // update combat timer only for players and pets (only pets with PetAI) if (isInCombat() && (GetTypeId() == TYPEID_PLAYER || (ToCreature()->isPet() && IsControlledByPlayer()))) { - // Check UNIT_STAT_MELEE_ATTACKING or UNIT_STAT_CHASE (without UNIT_STAT_FOLLOW in this case) so pets can reach far away + // Check UNIT_STATE_MELEE_ATTACKING or UNIT_STATE_CHASE (without UNIT_STATE_FOLLOW in this case) so pets can reach far away // targets without stopping half way there and running off. // These flags are reset after target dies or another command is given. if (m_HostileRefManager.isEmpty()) @@ -518,7 +518,7 @@ bool Unit::HasAuraTypeWithFamilyFlags(AuraType auraType, uint32 familyName, uint void Unit::DealDamageMods(Unit* victim, uint32 &damage, uint32* absorb) { - if (!victim || !victim->isAlive() || victim->HasUnitState(UNIT_STAT_IN_FLIGHT) || (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())) + if (!victim || !victim->isAlive() || victim->HasUnitState(UNIT_STATE_IN_FLIGHT) || (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())) { if (absorb) *absorb += damage; @@ -1046,7 +1046,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss) if (!victim) return; - if (!victim->isAlive() || victim->HasUnitState(UNIT_STAT_IN_FLIGHT) || (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())) + if (!victim->isAlive() || victim->HasUnitState(UNIT_STATE_IN_FLIGHT) || (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())) return; SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(damageInfo->SpellID); @@ -1263,7 +1263,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) { Unit* victim = damageInfo->target; - if (!victim->isAlive() || victim->HasUnitState(UNIT_STAT_IN_FLIGHT) || (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())) + if (!victim->isAlive() || victim->HasUnitState(UNIT_STATE_IN_FLIGHT) || (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsInEvadeMode())) return; // Hmmmm dont like this emotes client must by self do all animations @@ -1839,7 +1839,7 @@ void Unit::CalcHealAbsorb(Unit* victim, const SpellInfo* healSpell, uint32 &heal void Unit::AttackerStateUpdate (Unit* victim, WeaponAttackType attType, bool extra) { - if (HasUnitState(UNIT_STAT_CANNOT_AUTOATTACK) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)) + if (HasUnitState(UNIT_STATE_CANNOT_AUTOATTACK) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)) return; if (!victim->isAlive()) @@ -2557,7 +2557,7 @@ uint32 Unit::GetDefenseSkillValue(Unit const* target) const float Unit::GetUnitDodgeChance() const { - if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STAT_CONTROLLED)) + if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STATE_CONTROLLED)) return 0.0f; if (GetTypeId() == TYPEID_PLAYER) @@ -2577,7 +2577,7 @@ float Unit::GetUnitDodgeChance() const float Unit::GetUnitParryChance() const { - if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STAT_CONTROLLED)) + if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STATE_CONTROLLED)) return 0.0f; float chance = 0.0f; @@ -2623,7 +2623,7 @@ float Unit::GetUnitMissChance(WeaponAttackType attType) const float Unit::GetUnitBlockChance() const { - if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STAT_CONTROLLED)) + if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STATE_CONTROLLED)) return 0.0f; if (Player const* player = ToPlayer()) @@ -2875,7 +2875,7 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) InterruptSpell(CURRENT_AUTOREPEAT_SPELL); m_AutoRepeatFirstCast = true; } - AddUnitState(UNIT_STAT_CASTING); + AddUnitState(UNIT_STATE_CASTING); } break; case CURRENT_CHANNELED_SPELL: @@ -2888,7 +2888,7 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75) InterruptSpell(CURRENT_AUTOREPEAT_SPELL); - AddUnitState(UNIT_STAT_CASTING); + AddUnitState(UNIT_STATE_CASTING); } break; case CURRENT_AUTOREPEAT_SPELL: @@ -9347,16 +9347,16 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) // switch to melee attack from ranged/magic if (meleeAttack) { - if (!HasUnitState(UNIT_STAT_MELEE_ATTACKING)) + if (!HasUnitState(UNIT_STATE_MELEE_ATTACKING)) { - AddUnitState(UNIT_STAT_MELEE_ATTACKING); + AddUnitState(UNIT_STATE_MELEE_ATTACKING); SendMeleeAttackStart(victim); return true; } } - else if (HasUnitState(UNIT_STAT_MELEE_ATTACKING)) + else if (HasUnitState(UNIT_STATE_MELEE_ATTACKING)) { - ClearUnitState(UNIT_STAT_MELEE_ATTACKING); + ClearUnitState(UNIT_STATE_MELEE_ATTACKING); SendMeleeAttackStop(victim); return true; } @@ -9366,7 +9366,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) // switch target InterruptSpell(CURRENT_MELEE_SPELL); if (!meleeAttack) - ClearUnitState(UNIT_STAT_MELEE_ATTACKING); + ClearUnitState(UNIT_STATE_MELEE_ATTACKING); } if (m_attacking) @@ -9379,7 +9379,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) SetTarget(victim->GetGUID()); if (meleeAttack) - AddUnitState(UNIT_STAT_MELEE_ATTACKING); + AddUnitState(UNIT_STATE_MELEE_ATTACKING); // set position before any AI calls/assistance //if (GetTypeId() == TYPEID_UNIT) @@ -9420,7 +9420,7 @@ bool Unit::AttackStop() // Clear our target SetTarget(0); - ClearUnitState(UNIT_STAT_MELEE_ATTACKING); + ClearUnitState(UNIT_STATE_MELEE_ATTACKING); InterruptSpell(CURRENT_MELEE_SPELL); @@ -9463,7 +9463,7 @@ void Unit::CombatStopWithPets(bool includingCast) bool Unit::isAttackingPlayer() const { - if (HasUnitState(UNIT_STAT_ATTACK_PLAYER)) + if (HasUnitState(UNIT_STATE_ATTACK_PLAYER)) return true; for (ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) @@ -11899,7 +11899,7 @@ void Unit::Dismount() { if (Pet* pPet = player->GetPet()) { - if (pPet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && !pPet->HasUnitState(UNIT_STAT_STUNNED)) + if (pPet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED) && !pPet->HasUnitState(UNIT_STATE_STUNNED)) pPet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); } else @@ -11968,7 +11968,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy) if (PvP) m_CombatTimer = 5000; - if (isInCombat() || HasUnitState(UNIT_STAT_EVADE)) + if (isInCombat() || HasUnitState(UNIT_STATE_EVADE)) return; SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); @@ -12021,7 +12021,7 @@ void Unit::ClearInCombat() if (creature->GetCreatureInfo() && creature->GetCreatureInfo()->unit_flags & UNIT_FLAG_OOC_NOT_ATTACKABLE) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); // re-apply Out of Combat Non Attackable flag if we leave combat, can be overriden in scripts in EnterEvadeMode() - ClearUnitState(UNIT_STAT_ATTACK_PLAYER); + ClearUnitState(UNIT_STATE_ATTACK_PLAYER); if (HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED)) SetUInt32Value(UNIT_DYNAMIC_FLAGS, creature->GetCreatureInfo()->dynamicflags); @@ -12053,7 +12053,7 @@ bool Unit::isTargetableForAttack(bool checkFakeDeath) const if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->isGameMaster()) return false; - return !HasUnitState(UNIT_STAT_UNATTACKABLE) && (!checkFakeDeath || !HasUnitState(UNIT_STAT_DIED)); + return !HasUnitState(UNIT_STATE_UNATTACKABLE) && (!checkFakeDeath || !HasUnitState(UNIT_STATE_DIED)); } bool Unit::IsValidAttackTarget(Unit const* target) const @@ -12071,7 +12071,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co return false; // can't attack unattackable units or GMs - if (target->HasUnitState(UNIT_STAT_UNATTACKABLE) + if (target->HasUnitState(UNIT_STATE_UNATTACKABLE) || (target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->isGameMaster())) return false; @@ -12165,7 +12165,7 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co return true; // can't assist unattackable units or GMs - if (target->HasUnitState(UNIT_STAT_UNATTACKABLE) + if (target->HasUnitState(UNIT_STATE_UNATTACKABLE) || (target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->isGameMaster())) return false; @@ -14596,7 +14596,7 @@ void Unit::SendPetAIReaction(uint64 guid) void Unit::StopMoving() { - ClearUnitState(UNIT_STAT_MOVING); + ClearUnitState(UNIT_STATE_MOVING); // not need send any packets if not in world if (!IsInWorld()) @@ -14978,16 +14978,16 @@ void Unit::SetContestedPvP(Player* attackedPlayer) return; player->SetContestedPvPTimer(30000); - if (!player->HasUnitState(UNIT_STAT_ATTACK_PLAYER)) + if (!player->HasUnitState(UNIT_STATE_ATTACK_PLAYER)) { - player->AddUnitState(UNIT_STAT_ATTACK_PLAYER); + player->AddUnitState(UNIT_STATE_ATTACK_PLAYER); player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP); // call MoveInLineOfSight for nearby contested guards UpdateObjectVisibility(); } - if (!HasUnitState(UNIT_STAT_ATTACK_PLAYER)) + if (!HasUnitState(UNIT_STATE_ATTACK_PLAYER)) { - AddUnitState(UNIT_STAT_ATTACK_PLAYER); + AddUnitState(UNIT_STATE_ATTACK_PLAYER); // call MoveInLineOfSight for nearby contested guards UpdateObjectVisibility(); } @@ -15555,28 +15555,28 @@ void Unit::SetControlled(bool apply, UnitState state) AddUnitState(state); switch (state) { - case UNIT_STAT_STUNNED: + case UNIT_STATE_STUNNED: SetStunned(true); CastStop(); break; - case UNIT_STAT_ROOT: - if (!HasUnitState(UNIT_STAT_STUNNED)) + case UNIT_STATE_ROOT: + if (!HasUnitState(UNIT_STATE_STUNNED)) SetRooted(true); break; - case UNIT_STAT_CONFUSED: - if (!HasUnitState(UNIT_STAT_STUNNED)) + case UNIT_STATE_CONFUSED: + if (!HasUnitState(UNIT_STATE_STUNNED)) { - ClearUnitState(UNIT_STAT_MELEE_ATTACKING); + ClearUnitState(UNIT_STATE_MELEE_ATTACKING); SendMeleeAttackStop(); // SendAutoRepeatCancel ? SetConfused(true); CastStop(); } break; - case UNIT_STAT_FLEEING: - if (!HasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_CONFUSED)) + case UNIT_STATE_FLEEING: + if (!HasUnitState(UNIT_STATE_STUNNED | UNIT_STATE_CONFUSED)) { - ClearUnitState(UNIT_STAT_MELEE_ATTACKING); + ClearUnitState(UNIT_STATE_MELEE_ATTACKING); SendMeleeAttackStop(); // SendAutoRepeatCancel ? SetFeared(true); @@ -15591,29 +15591,29 @@ void Unit::SetControlled(bool apply, UnitState state) { switch (state) { - case UNIT_STAT_STUNNED: if (HasAuraType(SPELL_AURA_MOD_STUN)) return; + case UNIT_STATE_STUNNED: if (HasAuraType(SPELL_AURA_MOD_STUN)) return; else SetStunned(false); break; - case UNIT_STAT_ROOT: if (HasAuraType(SPELL_AURA_MOD_ROOT) || GetVehicle()) return; + case UNIT_STATE_ROOT: if (HasAuraType(SPELL_AURA_MOD_ROOT) || GetVehicle()) return; else SetRooted(false); break; - case UNIT_STAT_CONFUSED:if (HasAuraType(SPELL_AURA_MOD_CONFUSE)) return; + case UNIT_STATE_CONFUSED:if (HasAuraType(SPELL_AURA_MOD_CONFUSE)) return; else SetConfused(false); break; - case UNIT_STAT_FLEEING: if (HasAuraType(SPELL_AURA_MOD_FEAR)) return; + case UNIT_STATE_FLEEING: if (HasAuraType(SPELL_AURA_MOD_FEAR)) return; else SetFeared(false); break; default: return; } ClearUnitState(state); - if (HasUnitState(UNIT_STAT_STUNNED)) + if (HasUnitState(UNIT_STATE_STUNNED)) SetStunned(true); else { - if (HasUnitState(UNIT_STAT_ROOT)) + if (HasUnitState(UNIT_STATE_ROOT)) SetRooted(true); - if (HasUnitState(UNIT_STAT_CONFUSED)) + if (HasUnitState(UNIT_STATE_CONFUSED)) SetConfused(true); - else if (HasUnitState(UNIT_STAT_FLEEING)) + else if (HasUnitState(UNIT_STATE_FLEEING)) SetFeared(true); } } @@ -15655,7 +15655,7 @@ void Unit::SetStunned(bool apply) if (!owner || (owner->GetTypeId() == TYPEID_PLAYER && !owner->ToPlayer()->IsMounted())) RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - if (!HasUnitState(UNIT_STAT_ROOT)) // prevent moving if it also has root effect + if (!HasUnitState(UNIT_STATE_ROOT)) // prevent moving if it also has root effect { WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 8+4); data.append(GetPackGUID()); @@ -15697,7 +15697,7 @@ void Unit::SetRooted(bool apply) } else { - if (!HasUnitState(UNIT_STAT_STUNNED)) // prevent moving if it also has stun effect + if (!HasUnitState(UNIT_STATE_STUNNED)) // prevent moving if it also has stun effect { if (GetTypeId() == TYPEID_PLAYER) { @@ -15789,7 +15789,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au return false; } - //if (HasUnitState(UNIT_STAT_UNATTACKABLE)) + //if (HasUnitState(UNIT_STATE_UNATTACKABLE)) // return false; if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetTransport()) @@ -15882,7 +15882,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au charmer->ToPlayer()->VehicleSpellInitialize(); break; case CHARM_TYPE_POSSESS: - AddUnitState(UNIT_STAT_POSSESSED); + AddUnitState(UNIT_STATE_POSSESSED); SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); charmer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); charmer->ToPlayer()->SetClientControl(this, 1); @@ -15933,7 +15933,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) } CharmType type; - if (HasUnitState(UNIT_STAT_POSSESSED)) + if (HasUnitState(UNIT_STATE_POSSESSED)) type = CHARM_TYPE_POSSESS; else if (charmer && charmer->IsOnVehicle(this)) type = CHARM_TYPE_VEHICLE; @@ -15951,7 +15951,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) if (type == CHARM_TYPE_POSSESS) { - ClearUnitState(UNIT_STAT_POSSESSED); + ClearUnitState(UNIT_STATE_POSSESSED); RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); } @@ -16990,7 +16990,7 @@ void Unit::_ExitVehicle(Position const* exitPosition) Vehicle* vehicle = m_vehicle; m_vehicle = NULL; - SetControlled(false, UNIT_STAT_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT + SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT Position pos; if (!exitPosition) // Exit position not specified @@ -16998,7 +16998,7 @@ void Unit::_ExitVehicle(Position const* exitPosition) else pos = *exitPosition; - AddUnitState(UNIT_STAT_MOVE); + AddUnitState(UNIT_STATE_MOVE); if (GetTypeId() == TYPEID_PLAYER) ToPlayer()->SetFallInformation(0, GetPositionZ()); @@ -17390,7 +17390,7 @@ bool CharmInfo::IsReturning() void Unit::SetInFront(Unit const* target) { - if (!HasUnitState(UNIT_STAT_CANNOT_TURN)) + if (!HasUnitState(UNIT_STATE_CANNOT_TURN)) SetOrientation(GetAngle(target)); } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index b64a2e210bc..bb2ab7b9e2d 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -469,46 +469,46 @@ enum DeathState enum UnitState { - UNIT_STAT_DIED = 0x00000001, // player has fake death aura - UNIT_STAT_MELEE_ATTACKING = 0x00000002, // player is melee attacking someone - //UNIT_STAT_MELEE_ATTACK_BY = 0x00000004, // player is melee attack by someone - UNIT_STAT_STUNNED = 0x00000008, - UNIT_STAT_ROAMING = 0x00000010, - UNIT_STAT_CHASE = 0x00000020, - //UNIT_STAT_SEARCHING = 0x00000040, - UNIT_STAT_FLEEING = 0x00000080, - UNIT_STAT_IN_FLIGHT = 0x00000100, // player is in flight mode - UNIT_STAT_FOLLOW = 0x00000200, - UNIT_STAT_ROOT = 0x00000400, - UNIT_STAT_CONFUSED = 0x00000800, - UNIT_STAT_DISTRACTED = 0x00001000, - UNIT_STAT_ISOLATED = 0x00002000, // area auras do not affect other players - UNIT_STAT_ATTACK_PLAYER = 0x00004000, - UNIT_STAT_CASTING = 0x00008000, - UNIT_STAT_POSSESSED = 0x00010000, - UNIT_STAT_CHARGING = 0x00020000, - UNIT_STAT_JUMPING = 0x00040000, - UNIT_STAT_ONVEHICLE = 0x00080000, - UNIT_STAT_MOVE = 0x00100000, - UNIT_STAT_ROTATING = 0x00200000, - UNIT_STAT_EVADE = 0x00400000, - UNIT_STAT_ROAMING_MOVE = 0x00800000, - UNIT_STAT_CONFUSED_MOVE = 0x01000000, - UNIT_STAT_FLEEING_MOVE = 0x02000000, - UNIT_STAT_CHASE_MOVE = 0x04000000, - UNIT_STAT_FOLLOW_MOVE = 0x08000000, - UNIT_STAT_UNATTACKABLE = (UNIT_STAT_IN_FLIGHT | UNIT_STAT_ONVEHICLE), - //UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE), + UNIT_STATE_DIED = 0x00000001, // player has fake death aura + UNIT_STATE_MELEE_ATTACKING = 0x00000002, // player is melee attacking someone + //UNIT_STATE_MELEE_ATTACK_BY = 0x00000004, // player is melee attack by someone + UNIT_STATE_STUNNED = 0x00000008, + UNIT_STATE_ROAMING = 0x00000010, + UNIT_STATE_CHASE = 0x00000020, + //UNIT_STATE_SEARCHING = 0x00000040, + UNIT_STATE_FLEEING = 0x00000080, + UNIT_STATE_IN_FLIGHT = 0x00000100, // player is in flight mode + UNIT_STATE_FOLLOW = 0x00000200, + UNIT_STATE_ROOT = 0x00000400, + UNIT_STATE_CONFUSED = 0x00000800, + UNIT_STATE_DISTRACTED = 0x00001000, + UNIT_STATE_ISOLATED = 0x00002000, // area auras do not affect other players + UNIT_STATE_ATTACK_PLAYER = 0x00004000, + UNIT_STATE_CASTING = 0x00008000, + UNIT_STATE_POSSESSED = 0x00010000, + UNIT_STATE_CHARGING = 0x00020000, + UNIT_STATE_JUMPING = 0x00040000, + UNIT_STATE_ONVEHICLE = 0x00080000, + UNIT_STATE_MOVE = 0x00100000, + UNIT_STATE_ROTATING = 0x00200000, + UNIT_STATE_EVADE = 0x00400000, + UNIT_STATE_ROAMING_MOVE = 0x00800000, + UNIT_STATE_CONFUSED_MOVE = 0x01000000, + UNIT_STATE_FLEEING_MOVE = 0x02000000, + UNIT_STATE_CHASE_MOVE = 0x04000000, + UNIT_STATE_FOLLOW_MOVE = 0x08000000, + UNIT_STATE_UNATTACKABLE = (UNIT_STATE_IN_FLIGHT | UNIT_STATE_ONVEHICLE), + //UNIT_STATE_MOVING = (UNIT_STATE_ROAMING | UNIT_STATE_CHASE), // for real move using movegen check and stop (except unstoppable flight) - UNIT_STAT_MOVING = UNIT_STAT_ROAMING_MOVE | UNIT_STAT_CONFUSED_MOVE | UNIT_STAT_FLEEING_MOVE| UNIT_STAT_CHASE_MOVE | UNIT_STAT_FOLLOW_MOVE , - UNIT_STAT_CONTROLLED = (UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING), - UNIT_STAT_LOST_CONTROL = (UNIT_STAT_CONTROLLED | UNIT_STAT_JUMPING | UNIT_STAT_CHARGING), - UNIT_STAT_SIGHTLESS = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_EVADE), - UNIT_STAT_CANNOT_AUTOATTACK = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_CASTING), - UNIT_STAT_CANNOT_TURN = (UNIT_STAT_LOST_CONTROL | UNIT_STAT_ROTATING), + UNIT_STATE_MOVING = UNIT_STATE_ROAMING_MOVE | UNIT_STATE_CONFUSED_MOVE | UNIT_STATE_FLEEING_MOVE| UNIT_STATE_CHASE_MOVE | UNIT_STATE_FOLLOW_MOVE , + UNIT_STATE_CONTROLLED = (UNIT_STATE_CONFUSED | UNIT_STATE_STUNNED | UNIT_STATE_FLEEING), + UNIT_STATE_LOST_CONTROL = (UNIT_STATE_CONTROLLED | UNIT_STATE_JUMPING | UNIT_STATE_CHARGING), + UNIT_STATE_SIGHTLESS = (UNIT_STATE_LOST_CONTROL | UNIT_STATE_EVADE), + UNIT_STATE_CANNOT_AUTOATTACK = (UNIT_STATE_LOST_CONTROL | UNIT_STATE_CASTING), + UNIT_STATE_CANNOT_TURN = (UNIT_STATE_LOST_CONTROL | UNIT_STATE_ROTATING), // stay by different reasons - UNIT_STAT_NOT_MOVE = UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DIED | UNIT_STAT_DISTRACTED, - UNIT_STAT_ALL_STATE = 0xffffffff //(UNIT_STAT_STOPPED | UNIT_STAT_MOVING | UNIT_STAT_IN_COMBAT | UNIT_STAT_IN_FLIGHT) + UNIT_STATE_NOT_MOVE = UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DIED | UNIT_STATE_DISTRACTED, + UNIT_STATE_ALL_STATE = 0xffffffff //(UNIT_STATE_STOPPED | UNIT_STATE_MOVING | UNIT_STATE_IN_COMBAT | UNIT_STATE_IN_FLIGHT) }; enum UnitMoveType @@ -1289,8 +1289,8 @@ class Unit : public WorldObject void ClearUnitState(uint32 f) { m_state &= ~f; } bool CanFreeMove() const { - return !HasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING | UNIT_STAT_IN_FLIGHT | - UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) && GetOwnerGUID() == 0; + return !HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_FLEEING | UNIT_STATE_IN_FLIGHT | + UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED) && GetOwnerGUID() == 0; } uint32 HasUnitTypeMask(uint32 mask) const { return mask & m_unitTypeMask; } @@ -1525,7 +1525,7 @@ class Unit : public WorldObject } bool isSpiritService() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPIRITHEALER | UNIT_NPC_FLAG_SPIRITGUIDE); } - bool isInFlight() const { return HasUnitState(UNIT_STAT_IN_FLIGHT); } + bool isInFlight() const { return HasUnitState(UNIT_STATE_IN_FLIGHT); } bool isInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); } void CombatStart(Unit* target, bool initialAggro = true); @@ -1682,8 +1682,8 @@ class Unit : public WorldObject void RemoveAllControlled(); bool isCharmed() const { return GetCharmerGUID() != 0; } - bool isPossessed() const { return HasUnitState(UNIT_STAT_POSSESSED); } - bool isPossessedByPlayer() const { return HasUnitState(UNIT_STAT_POSSESSED) && IS_PLAYER_GUID(GetCharmerGUID()); } + bool isPossessed() const { return HasUnitState(UNIT_STATE_POSSESSED); } + bool isPossessedByPlayer() const { return HasUnitState(UNIT_STATE_POSSESSED) && IS_PLAYER_GUID(GetCharmerGUID()); } bool isPossessing() const { if (Unit* u = GetCharm()) @@ -2048,7 +2048,7 @@ class Unit : public WorldObject MotionMaster* GetMotionMaster() { return &i_motionMaster; } const MotionMaster* GetMotionMaster() const { return &i_motionMaster; } - bool IsStopped() const { return !(HasUnitState(UNIT_STAT_MOVING)); } + bool IsStopped() const { return !(HasUnitState(UNIT_STATE_MOVING)); } void StopMoving(); void AddUnitMovementFlag(uint32 f) { m_movementInfo.flags |= f; } diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 7e4bebaab95..fc6c6cb063e 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -176,7 +176,7 @@ void Vehicle::ApplyAllImmunities() case 160: // Strand of the Ancients case 244: // Wintergrasp case 510: // Isle of Conquest - _me->SetControlled(true, UNIT_STAT_ROOT); + _me->SetControlled(true, UNIT_STATE_ROOT); // why we need to apply this? we can simple add immunities to slow mechanic in DB _me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_DECREASE_SPEED, true); break; @@ -342,7 +342,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) } if (seat->second.SeatInfo->m_flags && !(seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_UNK1)) - unit->AddUnitState(UNIT_STAT_ONVEHICLE); + unit->AddUnitState(UNIT_STATE_ONVEHICLE); unit->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); VehicleSeatEntry const* veSeat = seat->second.SeatInfo; @@ -364,7 +364,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) if (_me->IsInWorld()) { unit->SendClearTarget(); // SMSG_BREAK_TARGET - unit->SetControlled(true, UNIT_STAT_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures) + unit->SetControlled(true, UNIT_STATE_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures) // also adds MOVEMENTFLAG_ROOT unit->SendMonsterMoveTransport(_me); // SMSG_MONSTER_MOVE_TRANSPORT @@ -407,7 +407,7 @@ void Vehicle::RemovePassenger(Unit* unit) ++_usableSeatNum; } - unit->ClearUnitState(UNIT_STAT_ONVEHICLE); + unit->ClearUnitState(UNIT_STATE_ONVEHICLE); if (_me->GetTypeId() == TYPEID_UNIT && unit->GetTypeId() == TYPEID_PLAYER && seat->first == 0 && seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL) _me->RemoveCharmedBy(unit); diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp index 5e5fbf4a9a6..2446e9d4276 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp +++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp @@ -113,7 +113,7 @@ inline void CreatureUnitRelocationWorker(Creature* c, Unit* u) if (!u->isAlive() || !c->isAlive() || c == u || u->isInFlight()) return; - if (c->HasReactState(REACT_AGGRESSIVE) && !c->HasUnitState(UNIT_STAT_SIGHTLESS)) + if (c->HasReactState(REACT_AGGRESSIVE) && !c->HasUnitState(UNIT_STATE_SIGHTLESS)) if (c->IsAIEnabled && c->canSeeOrDetect(u, false, true)) c->AI()->MoveInLineOfSight_Safe(u); } diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index dd73cdcb1f0..e3029a1be65 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -746,7 +746,7 @@ namespace Trinity bool operator()(Unit* u) { if (u->isAlive() && u->isInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && - (u->isFeared() || u->isCharmed() || u->isFrozen() || u->HasUnitState(UNIT_STAT_STUNNED) || u->HasUnitState(UNIT_STAT_CONFUSED))) + (u->isFeared() || u->isCharmed() || u->isFrozen() || u->HasUnitState(UNIT_STATE_STUNNED) || u->HasUnitState(UNIT_STATE_CONFUSED))) { return true; } diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 59eefb9fa77..8a98b038efd 100755 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -46,7 +46,7 @@ void WorldSession::HandleAuctionHelloOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); SendAuctionHello(guid, unit); @@ -161,7 +161,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); Item* it = player->GetItemByGuid(item); @@ -274,7 +274,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); @@ -394,7 +394,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); @@ -482,7 +482,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); @@ -531,7 +531,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); @@ -586,7 +586,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index bd9668ce5b8..0094c20d927 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1004,7 +1004,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder) sLog->outChar("Account: %d (IP: %s) Login Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow()); - if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STAT_STUNNED)) + if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) pCurrChar->SetStandState(UNIT_STAND_STATE_STAND); m_playerLoading = false; diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index 3d689196256..966eae598a6 100755 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -481,7 +481,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) void WorldSession::HandleEmoteOpcode(WorldPacket & recv_data) { - if (!GetPlayer()->isAlive() || GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (!GetPlayer()->isAlive() || GetPlayer()->HasUnitState(UNIT_STATE_DIED)) return; uint32 emote; @@ -558,7 +558,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data) break; default: // Only allow text-emotes for "dead" entities (feign death included) - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) break; GetPlayer()->HandleEmoteCommand(emote_anim); break; diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp index d2a5f8014b8..9115f8f0f1e 100755 --- a/src/server/game/Handlers/GuildHandler.cpp +++ b/src/server/game/Handlers/GuildHandler.cpp @@ -303,7 +303,7 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket) if (GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_TABARDDESIGNER)) { // Remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); if (Guild* guild = _GetPlayerGuild(this)) diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index 47700fd088a..802597e14eb 100755 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -503,7 +503,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); Item* pItem = _player->GetItemByGuid(itemguid); @@ -614,7 +614,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); Item* pItem = _player->GetItemFromBuyBackSlot(slot); @@ -732,11 +732,11 @@ void WorldSession::SendListInventory(uint64 vendorGuid) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); // Stop the npc if moving - if (vendor->HasUnitState(UNIT_STAT_MOVING)) + if (vendor->HasUnitState(UNIT_STATE_MOVING)) vendor->StopMoving(); VendorItemData const* items = vendor->GetVendorItems(); diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index d1227c9b7d7..f109332e235 100755 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -122,7 +122,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); if ((unit && unit->GetCreatureInfo()->ScriptID != unit->LastUsedScriptID) || (go && go->GetGOInfo()->ScriptId != go->LastUsedScriptID)) diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index ef49b337b44..1f286a0af05 100755 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -60,7 +60,7 @@ void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); SendTabardVendorActivate(guid); @@ -89,7 +89,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); SendShowBank(guid); @@ -128,7 +128,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); // trainer list loaded at check; @@ -250,7 +250,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); if (!unit->isCanTrainingOf(_player, true)) @@ -314,7 +314,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data) GetPlayer()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK); // remove fake death - //if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + //if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) // GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); if (unit->isArmorer() || unit->isCivilian() || unit->isQuestGiver() || unit->isServiceProvider() || unit->isGuard()) @@ -369,7 +369,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); if (!code.empty()) @@ -400,7 +400,7 @@ void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); SendSpiritResurrect(); @@ -455,7 +455,7 @@ void WorldSession::HandleBinderActivateOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); SendBindPoint(unit); @@ -507,7 +507,7 @@ void WorldSession::HandleListStabledPetsOpcode(WorldPacket & recv_data) return; // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); // remove mounts this fix bug where getting pet from stable while mounted deletes pet. @@ -609,7 +609,7 @@ void WorldSession::HandleStablePet(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); Pet* pet = _player->GetPet(); @@ -679,7 +679,7 @@ void WorldSession::HandleUnstablePet(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_ENTRY); @@ -759,7 +759,7 @@ void WorldSession::HandleBuyStableSlot(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); if (GetPlayer()->m_stableSlots < MAX_PET_STABLES) @@ -798,7 +798,7 @@ void WorldSession::HandleStableSwapPet(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); Pet* pet = _player->GetPet(); @@ -886,7 +886,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); // reputation discount diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index 68ce3153450..16b6a4bb714 100755 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -202,7 +202,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid return; } - pet->ClearUnitState(UNIT_STAT_FOLLOW); + pet->ClearUnitState(UNIT_STATE_FOLLOW); // This is true if pet has no target or has target but targets differs. if (pet->getVictim() != TargetUnit || (pet->getVictim() == TargetUnit && !pet->GetCharmInfo()->IsCommandAttack())) { @@ -777,7 +777,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) targets.Read(recvPacket, caster); HandleClientCastFlags(recvPacket, castFlags, targets); - caster->ClearUnitState(UNIT_STAT_FOLLOW); + caster->ClearUnitState(UNIT_STATE_FOLLOW); Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE); spell->m_cast_count = castCount; // probably pending spell cast diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp index 26185d3376d..b4c07811598 100755 --- a/src/server/game/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Handlers/PetitionsHandler.cpp @@ -98,7 +98,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); uint32 charterid = 0; diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 7e80c780369..f9aa40cdcda 100755 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -95,7 +95,7 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); // Stop the npc if moving creature->StopMoving(); diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp index 520cd89e7d5..355effba0c6 100755 --- a/src/server/game/Handlers/SkillHandler.cpp +++ b/src/server/game/Handlers/SkillHandler.cpp @@ -68,7 +68,7 @@ void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); if (!(_player->resetTalents())) diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp index 3533b153bd8..8eb1eab06d9 100755 --- a/src/server/game/Handlers/TaxiHandler.cpp +++ b/src/server/game/Handlers/TaxiHandler.cpp @@ -79,7 +79,7 @@ void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket & recv_data) } // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); // unknown taxi node case @@ -118,7 +118,7 @@ void WorldSession::SendTaxiMenu(Creature* unit) void WorldSession::SendDoFlight(uint32 mountDisplayId, uint32 path, uint32 pathNode) { // remove fake death - if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); while (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE) diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index ebe54eb17eb..4c39992f344 100755 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -561,7 +561,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) return; } - if (GetPlayer()->HasUnitState(UNIT_STAT_STUNNED)) + if (GetPlayer()->HasUnitState(UNIT_STATE_STUNNED)) { SendTradeStatus(TRADE_STATUS_YOU_STUNNED); return; @@ -611,7 +611,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket) return; } - if (pOther->HasUnitState(UNIT_STAT_STUNNED)) + if (pOther->HasUnitState(UNIT_STATE_STUNNED)) { SendTradeStatus(TRADE_STATUS_TARGET_STUNNED); return; diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 8975a2d7d7b..4945ae2a014 100755 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -80,7 +80,7 @@ void MotionMaster::UpdateMotion(uint32 diff) if (!i_owner) return; - if (i_owner->HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) // what about UNIT_STAT_DISTRACTED? Why is this not included? + if (i_owner->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) // what about UNIT_STATE_DISTRACTED? Why is this not included? return; ASSERT(!empty()); @@ -237,7 +237,7 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle) if (!target || target == i_owner || i_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) return; - //i_owner->ClearUnitState(UNIT_STAT_FOLLOW); + //i_owner->ClearUnitState(UNIT_STATE_FOLLOW); if (i_owner->GetTypeId() == TYPEID_PLAYER) { sLog->outStaticDebug("Player (GUID: %u) chase to %s (GUID: %u)", @@ -262,7 +262,7 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo if (!target || target == i_owner || i_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) return; - //i_owner->AddUnitState(UNIT_STAT_FOLLOW); + //i_owner->AddUnitState(UNIT_STATE_FOLLOW); if (i_owner->GetTypeId() == TYPEID_PLAYER) { sLog->outStaticDebug("Player (GUID: %u) follow to %s (GUID: %u)", i_owner->GetGUIDLow(), diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp index 94608d85420..32b960028c2 100755 --- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp @@ -71,7 +71,7 @@ void ConfusedMovementGenerator::Initialize(T &unit) unit.StopMoving(); unit.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED); - unit.AddUnitState(UNIT_STAT_CONFUSED|UNIT_STAT_CONFUSED_MOVE); + unit.AddUnitState(UNIT_STATE_CONFUSED|UNIT_STATE_CONFUSED_MOVE); } template<> @@ -94,19 +94,19 @@ void ConfusedMovementGenerator::Reset(T &unit) i_nextMove = 1; i_nextMoveTime.Reset(0); unit.StopMoving(); - unit.AddUnitState(UNIT_STAT_CONFUSED|UNIT_STAT_CONFUSED_MOVE); + unit.AddUnitState(UNIT_STATE_CONFUSED|UNIT_STATE_CONFUSED_MOVE); } template bool ConfusedMovementGenerator::Update(T &unit, const uint32 &diff) { - if (unit.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED)) + if (unit.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED)) return true; if (i_nextMoveTime.Passed()) { // currently moving, update location - unit.AddUnitState(UNIT_STAT_CONFUSED_MOVE); + unit.AddUnitState(UNIT_STATE_CONFUSED_MOVE); if (unit.movespline->Finalized()) { @@ -121,7 +121,7 @@ bool ConfusedMovementGenerator::Update(T &unit, const uint32 &diff) if(i_nextMoveTime.Passed() ) { // start moving - unit.AddUnitState(UNIT_STAT_CONFUSED_MOVE); + unit.AddUnitState(UNIT_STATE_CONFUSED_MOVE); ASSERT( i_nextMove <= MAX_CONF_WAYPOINTS ); float x = i_waypoints[i_nextMove][0]; @@ -141,14 +141,14 @@ template<> void ConfusedMovementGenerator::Finalize(Player &unit) { unit.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED); - unit.ClearUnitState(UNIT_STAT_CONFUSED|UNIT_STAT_CONFUSED_MOVE); + unit.ClearUnitState(UNIT_STATE_CONFUSED|UNIT_STATE_CONFUSED_MOVE); } template<> void ConfusedMovementGenerator::Finalize(Creature &unit) { unit.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED); - unit.ClearUnitState(UNIT_STAT_CONFUSED|UNIT_STAT_CONFUSED_MOVE); + unit.ClearUnitState(UNIT_STATE_CONFUSED|UNIT_STATE_CONFUSED_MOVE); if (unit.getVictim()) unit.SetTarget(unit.getVictim()->GetGUID()); } diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp index 458e6f9a62c..ed5b73dd378 100755 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp @@ -34,7 +34,7 @@ FleeingMovementGenerator::_setTargetLocation(T &owner) if (!&owner) return; - if (owner.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) + if (owner.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) return; if (!_setMoveData(owner)) @@ -44,7 +44,7 @@ FleeingMovementGenerator::_setTargetLocation(T &owner) if (!_getPoint(owner, x, y, z)) return; - owner.AddUnitState(UNIT_STAT_FLEEING_MOVE); + owner.AddUnitState(UNIT_STATE_FLEEING_MOVE); Movement::MoveSplineInit init(owner); init.MoveTo(x,y,z); @@ -287,7 +287,7 @@ FleeingMovementGenerator::Initialize(T &owner) return; owner.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING); - owner.AddUnitState(UNIT_STAT_FLEEING|UNIT_STAT_FLEEING_MOVE); + owner.AddUnitState(UNIT_STATE_FLEEING|UNIT_STATE_FLEEING_MOVE); _Init(owner); @@ -335,14 +335,14 @@ template<> void FleeingMovementGenerator::Finalize(Player &owner) { owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING); - owner.ClearUnitState(UNIT_STAT_FLEEING|UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING|UNIT_STATE_FLEEING_MOVE); } template<> void FleeingMovementGenerator::Finalize(Creature &owner) { owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING); - owner.ClearUnitState(UNIT_STAT_FLEEING|UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING|UNIT_STATE_FLEEING_MOVE); if (owner.getVictim()) owner.SetTarget(owner.getVictim()->GetGUID()); } @@ -359,9 +359,9 @@ FleeingMovementGenerator::Update(T &owner, const uint32 &time_diff) { if (!&owner || !owner.isAlive()) return false; - if (owner.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) + if (owner.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) { - owner.ClearUnitState(UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING_MOVE); return true; } @@ -388,7 +388,7 @@ template bool FleeingMovementGenerator::Update(Creature &, const uint3 void TimedFleeingMovementGenerator::Finalize(Unit &owner) { owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING); - owner.ClearUnitState(UNIT_STAT_FLEEING|UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING|UNIT_STATE_FLEEING_MOVE); if (Unit* victim = owner.getVictim()) { if (owner.isAlive()) @@ -404,9 +404,9 @@ bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32 time_diff) if (!owner.isAlive()) return false; - if (owner.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) + if (owner.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) { - owner.ClearUnitState(UNIT_STAT_FLEEING_MOVE); + owner.ClearUnitState(UNIT_STATE_FLEEING_MOVE); return true; } diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp index 84997d6d1ae..dc47898352e 100755 --- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp @@ -25,7 +25,7 @@ void HomeMovementGenerator::Initialize(Creature & owner) { - owner.AddUnitState(UNIT_STAT_EVADE); + owner.AddUnitState(UNIT_STATE_EVADE); _setTargetLocation(owner); } @@ -38,7 +38,7 @@ void HomeMovementGenerator::_setTargetLocation(Creature & owner) if (!&owner) return; - if (owner.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED)) + if (owner.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED)) return; Movement::MoveSplineInit init(owner); @@ -54,7 +54,7 @@ void HomeMovementGenerator::_setTargetLocation(Creature & owner) init.Launch(); arrived = false; - owner.ClearUnitState(UNIT_STAT_ALL_STATE & ~UNIT_STAT_EVADE); + owner.ClearUnitState(UNIT_STATE_ALL_STATE & ~UNIT_STATE_EVADE); } bool HomeMovementGenerator::Update(Creature &owner, const uint32 time_diff) @@ -67,7 +67,7 @@ void HomeMovementGenerator::Finalize(Creature& owner) { if (arrived) { - owner.ClearUnitState(UNIT_STAT_EVADE); + owner.ClearUnitState(UNIT_STATE_EVADE); owner.SetWalk(true); owner.LoadCreaturesAddon(true); owner.AI()->JustReachedHome(); diff --git a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp index 43d3cccfe48..36561e00b93 100755 --- a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp @@ -32,19 +32,19 @@ void IdleMovementGenerator::Initialize(Unit &owner) void IdleMovementGenerator::Reset(Unit& owner) { - if (owner.HasUnitState(UNIT_STAT_MOVE)) + if (owner.HasUnitState(UNIT_STATE_MOVE)) owner.StopMoving(); } void RotateMovementGenerator::Initialize(Unit& owner) { - if (owner.HasUnitState(UNIT_STAT_MOVE)) + if (owner.HasUnitState(UNIT_STATE_MOVE)) owner.StopMoving(); if (owner.getVictim()) owner.SetInFront(owner.getVictim()); - owner.AddUnitState(UNIT_STAT_ROTATING); + owner.AddUnitState(UNIT_STATE_ROTATING); owner.AttackStop(); } @@ -75,7 +75,7 @@ bool RotateMovementGenerator::Update(Unit& owner, const uint32 diff) void RotateMovementGenerator::Finalize(Unit &unit) { - unit.ClearUnitState(UNIT_STAT_ROTATING); + unit.ClearUnitState(UNIT_STATE_ROTATING); if (unit.GetTypeId() == TYPEID_UNIT) unit.ToCreature()->AI()->MovementInform(ROTATE_MOTION_TYPE, 0); } @@ -83,13 +83,13 @@ void RotateMovementGenerator::Finalize(Unit &unit) void DistractMovementGenerator::Initialize(Unit& owner) { - owner.AddUnitState(UNIT_STAT_DISTRACTED); + owner.AddUnitState(UNIT_STATE_DISTRACTED); } void DistractMovementGenerator::Finalize(Unit& owner) { - owner.ClearUnitState(UNIT_STAT_DISTRACTED); + owner.ClearUnitState(UNIT_STATE_DISTRACTED); } bool @@ -105,7 +105,7 @@ DistractMovementGenerator::Update(Unit& /*owner*/, const uint32 time_diff) void AssistanceDistractMovementGenerator::Finalize(Unit &unit) { - unit.ClearUnitState(UNIT_STAT_DISTRACTED); + unit.ClearUnitState(UNIT_STATE_DISTRACTED); unit.ToCreature()->SetReactState(REACT_AGGRESSIVE); } diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp index 88465017dc2..02f9ebce847 100755 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp @@ -32,7 +32,7 @@ void PointMovementGenerator::Initialize(T &unit) if (!unit.IsStopped()) unit.StopMoving(); - unit.AddUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE); Movement::MoveSplineInit init(unit); init.MoveTo(i_x, i_y, i_z); if (speed > 0.0f) @@ -46,20 +46,20 @@ bool PointMovementGenerator::Update(T &unit, const uint32 &diff) if (!&unit) return false; - if(unit.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED)) + if(unit.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) { - unit.ClearUnitState(UNIT_STAT_ROAMING_MOVE); + unit.ClearUnitState(UNIT_STATE_ROAMING_MOVE); return true; } - unit.AddUnitState(UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STATE_ROAMING_MOVE); return !unit.movespline->Finalized(); } template void PointMovementGenerator:: Finalize(T &unit) { - unit.ClearUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE); + unit.ClearUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE); if (unit.movespline->Finalized()) MovementInform(unit); @@ -71,7 +71,7 @@ void PointMovementGenerator::Reset(T &unit) if (!unit.IsStopped()) unit.StopMoving(); - unit.AddUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE); + unit.AddUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE); } template @@ -120,7 +120,7 @@ void EffectMovementGenerator::Finalize(Unit &unit) if (((Creature&)unit).AI() && unit.movespline->Finalized()) ((Creature&)unit).AI()->MovementInform(EFFECT_MOTION_TYPE, m_Id); // Need restore previous movement since we have no proper states system - //if (unit.isAlive() && !unit.HasUnitState(UNIT_STAT_CONFUSED|UNIT_STAT_FLEEING)) + //if (unit.isAlive() && !unit.HasUnitState(UNIT_STATE_CONFUSED|UNIT_STATE_FLEEING)) //{ // if (Unit * victim = unit.getVictim()) // unit.GetMotionMaster()->MoveChase(victim); diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp index 0205b734058..22adc7be92f 100755 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp @@ -102,7 +102,7 @@ void RandomMovementGenerator::_setRandomLocation(Creature &creature) else i_nextMoveTime.Reset(urand(500, 10000)); - creature.AddUnitState(UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STATE_ROAMING_MOVE); Movement::MoveSplineInit init(creature); init.MoveTo(destX, destY, destZ); @@ -123,7 +123,7 @@ void RandomMovementGenerator::Initialize(Creature &creature) if (!wander_distance) wander_distance = creature.GetRespawnRadius(); - creature.AddUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE); _setRandomLocation(creature); } @@ -137,7 +137,7 @@ RandomMovementGenerator::Reset(Creature &creature) template<> void RandomMovementGenerator::Finalize(Creature &creature) { - creature.ClearUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE); + creature.ClearUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE); creature.SetWalk(false); } @@ -145,10 +145,10 @@ template<> bool RandomMovementGenerator::Update(Creature &creature, const uint32 diff) { - if (creature.HasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED)) + if (creature.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED)) { i_nextMoveTime.Reset(0); // Expire the timer - creature.ClearUnitState(UNIT_STAT_ROAMING_MOVE); + creature.ClearUnitState(UNIT_STATE_ROAMING_MOVE); return true; } diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index 0d2982ab6b7..964b4402438 100755 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -34,7 +34,7 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T &owner) if (!i_target.isValid() || !i_target->IsInWorld()) return; - if (owner.HasUnitState(UNIT_STAT_NOT_MOVE)) + if (owner.HasUnitState(UNIT_STATE_NOT_MOVE)) return; float x, y, z; @@ -125,7 +125,7 @@ bool TargetedMovementGeneratorMedium::Update(T &owner, const uint32 & time_ if (!owner.isAlive()) return true; - if (owner.HasUnitState(UNIT_STAT_NOT_MOVE)) + if (owner.HasUnitState(UNIT_STATE_NOT_MOVE)) { D::_clearUnitStateMove(owner); return true; @@ -188,7 +188,7 @@ void ChaseMovementGenerator::_reachTarget(T &owner) template<> void ChaseMovementGenerator::Initialize(Player &owner) { - owner.AddUnitState(UNIT_STAT_CHASE|UNIT_STAT_CHASE_MOVE); + owner.AddUnitState(UNIT_STATE_CHASE|UNIT_STATE_CHASE_MOVE); _setTargetLocation(owner); } @@ -196,14 +196,14 @@ template<> void ChaseMovementGenerator::Initialize(Creature &owner) { owner.SetWalk(false); - owner.AddUnitState(UNIT_STAT_CHASE|UNIT_STAT_CHASE_MOVE); + owner.AddUnitState(UNIT_STATE_CHASE|UNIT_STATE_CHASE_MOVE); _setTargetLocation(owner); } template void ChaseMovementGenerator::Finalize(T &owner) { - owner.ClearUnitState(UNIT_STAT_CHASE|UNIT_STAT_CHASE_MOVE); + owner.ClearUnitState(UNIT_STATE_CHASE|UNIT_STATE_CHASE_MOVE); } template @@ -259,7 +259,7 @@ void FollowMovementGenerator::_updateSpeed(Creature &u) template<> void FollowMovementGenerator::Initialize(Player &owner) { - owner.AddUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE); + owner.AddUnitState(UNIT_STATE_FOLLOW|UNIT_STATE_FOLLOW_MOVE); _updateSpeed(owner); _setTargetLocation(owner); } @@ -267,7 +267,7 @@ void FollowMovementGenerator::Initialize(Player &owner) template<> void FollowMovementGenerator::Initialize(Creature &owner) { - owner.AddUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE); + owner.AddUnitState(UNIT_STATE_FOLLOW|UNIT_STATE_FOLLOW_MOVE); _updateSpeed(owner); _setTargetLocation(owner); } @@ -275,7 +275,7 @@ void FollowMovementGenerator::Initialize(Creature &owner) template void FollowMovementGenerator::Finalize(T &owner) { - owner.ClearUnitState(UNIT_STAT_FOLLOW|UNIT_STAT_FOLLOW_MOVE); + owner.ClearUnitState(UNIT_STATE_FOLLOW|UNIT_STATE_FOLLOW_MOVE); _updateSpeed(owner); } diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h index 696c99e1460..bf2eecc89f6 100755 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h @@ -79,8 +79,8 @@ class ChaseMovementGenerator : public TargetedMovementGeneratorMediumGetTarget(); } void _reachTarget(T &); @@ -103,8 +103,8 @@ class FollowMovementGenerator : public TargetedMovementGeneratorMedium::LoadPath(Creature &creature) void WaypointMovementGenerator::Initialize(Creature &creature) { LoadPath(creature); - creature.AddUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE); } void WaypointMovementGenerator::Finalize(Creature &creature) { - creature.ClearUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE); + creature.ClearUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE); creature.SetWalk(false); } void WaypointMovementGenerator::Reset(Creature &creature) { - creature.AddUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STATE_ROAMING|UNIT_STATE_ROAMING_MOVE); StartMoveNow(creature); } @@ -73,7 +73,7 @@ void WaypointMovementGenerator::OnArrived(Creature& creature) if (m_isArrivalDone) return; - creature.ClearUnitState(UNIT_STAT_ROAMING_MOVE); + creature.ClearUnitState(UNIT_STATE_ROAMING_MOVE); m_isArrivalDone = true; if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance) @@ -111,7 +111,7 @@ bool WaypointMovementGenerator::StartMove(Creature &creature) m_isArrivalDone = false; - creature.AddUnitState(UNIT_STAT_ROAMING_MOVE); + creature.AddUnitState(UNIT_STATE_ROAMING_MOVE); Movement::MoveSplineInit init(creature); init.MoveTo(node->x, node->y, node->z); @@ -133,9 +133,9 @@ bool WaypointMovementGenerator::Update(Creature &creature, const uint3 { // Waypoint movement can be switched on/off // This is quite handy for escort quests and other stuff - if (creature.HasUnitState(UNIT_STAT_NOT_MOVE)) + if (creature.HasUnitState(UNIT_STATE_NOT_MOVE)) { - creature.ClearUnitState(UNIT_STAT_ROAMING_MOVE); + creature.ClearUnitState(UNIT_STATE_ROAMING_MOVE); return true; } // prevent a crash at empty waypoint path. @@ -204,7 +204,7 @@ void FlightPathMovementGenerator::Initialize(Player &player) void FlightPathMovementGenerator::Finalize(Player & player) { // remove flag to prevent send object build movement packets for flight state and crash (movement generator already not at top of stack) - player.ClearUnitState(UNIT_STAT_IN_FLIGHT); + player.ClearUnitState(UNIT_STATE_IN_FLIGHT); player.Dismount(); player.RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT); @@ -227,7 +227,7 @@ void FlightPathMovementGenerator::Finalize(Player & player) void FlightPathMovementGenerator::Reset(Player & player) { player.getHostileRefManager().setOnlineOfflineState(false); - player.AddUnitState(UNIT_STAT_IN_FLIGHT); + player.AddUnitState(UNIT_STATE_IN_FLIGHT); player.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT); Movement::MoveSplineInit init(player); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 7c09a2f32c6..1972b625a9f 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2417,7 +2417,7 @@ void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, boo target->VisitNearbyObject(target->GetMap()->GetVisibilityRange(), searcher); for (UnitList::iterator iter = targets.begin(); iter != targets.end(); ++iter) { - if (!(*iter)->HasUnitState(UNIT_STAT_CASTING)) + if (!(*iter)->HasUnitState(UNIT_STATE_CASTING)) continue; for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++) @@ -2448,7 +2448,7 @@ void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, boo // blizz like 2.0.x target->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - target->AddUnitState(UNIT_STAT_DIED); + target->AddUnitState(UNIT_STATE_DIED); } else { @@ -2465,7 +2465,7 @@ void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, boo // blizz like 2.0.x target->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); - target->ClearUnitState(UNIT_STAT_DIED); + target->ClearUnitState(UNIT_STATE_DIED); } } @@ -3031,7 +3031,7 @@ void AuraEffect::HandleModConfuse(AuraApplication const* aurApp, uint8 mode, boo Unit* target = aurApp->GetTarget(); - target->SetControlled(apply, UNIT_STAT_CONFUSED); + target->SetControlled(apply, UNIT_STATE_CONFUSED); } void AuraEffect::HandleModFear(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -3041,7 +3041,7 @@ void AuraEffect::HandleModFear(AuraApplication const* aurApp, uint8 mode, bool a Unit* target = aurApp->GetTarget(); - target->SetControlled(apply, UNIT_STAT_FLEEING); + target->SetControlled(apply, UNIT_STATE_FLEEING); } void AuraEffect::HandleAuraModStun(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -3051,7 +3051,7 @@ void AuraEffect::HandleAuraModStun(AuraApplication const* aurApp, uint8 mode, bo Unit* target = aurApp->GetTarget(); - target->SetControlled(apply, UNIT_STAT_STUNNED); + target->SetControlled(apply, UNIT_STATE_STUNNED); } void AuraEffect::HandleAuraModRoot(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -3061,7 +3061,7 @@ void AuraEffect::HandleAuraModRoot(AuraApplication const* aurApp, uint8 mode, bo Unit* target = aurApp->GetTarget(); - target->SetControlled(apply, UNIT_STAT_ROOT); + target->SetControlled(apply, UNIT_STATE_ROOT); } void AuraEffect::HandlePreventFleeing(AuraApplication const* aurApp, uint8 mode, bool apply) const @@ -3072,7 +3072,7 @@ void AuraEffect::HandlePreventFleeing(AuraApplication const* aurApp, uint8 mode, Unit* target = aurApp->GetTarget(); if (target->HasAuraType(SPELL_AURA_MOD_FEAR)) - target->SetControlled(!(apply), UNIT_STAT_FLEEING); + target->SetControlled(!(apply), UNIT_STATE_FLEEING); } /***************************/ @@ -3465,7 +3465,7 @@ void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint if (GetSpellInfo()->Mechanic == MECHANIC_BANISH) { if (apply) - target->AddUnitState(UNIT_STAT_ISOLATED); + target->AddUnitState(UNIT_STATE_ISOLATED); else { bool banishFound = false; @@ -3477,7 +3477,7 @@ void AuraEffect::HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint break; } if (!banishFound) - target->ClearUnitState(UNIT_STAT_ISOLATED); + target->ClearUnitState(UNIT_STATE_ISOLATED); } } @@ -6156,7 +6156,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const if (!caster || !target->isAlive()) return; - if (target->HasUnitState(UNIT_STAT_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) + if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) { SendTickImmune(target, caster); return; @@ -6297,7 +6297,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c if (!caster || !caster->isAlive() || !target->isAlive()) return; - if (target->HasUnitState(UNIT_STAT_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) + if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) { SendTickImmune(target, caster); return; @@ -6363,7 +6363,7 @@ void AuraEffect::HandlePeriodicHealthFunnelAuraTick(Unit* target, Unit* caster) if (!caster || !caster->isAlive() || !target->isAlive()) return; - if (target->HasUnitState(UNIT_STAT_ISOLATED)) + if (target->HasUnitState(UNIT_STATE_ISOLATED)) { SendTickImmune(target, caster); return; @@ -6391,7 +6391,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const if (!caster || !target->isAlive()) return; - if (target->HasUnitState(UNIT_STAT_ISOLATED)) + if (target->HasUnitState(UNIT_STATE_ISOLATED)) { SendTickImmune(target, caster); return; @@ -6507,7 +6507,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con if (!caster || !caster->isAlive() || !target->isAlive() || target->getPowerType() != powerType) return; - if (target->HasUnitState(UNIT_STAT_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) + if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) { SendTickImmune(target, caster); return; @@ -6607,7 +6607,7 @@ void AuraEffect::HandleObsModPowerAuraTick(Unit* target, Unit* caster) const if (!target->isAlive() || !target->GetMaxPower(powerType)) return; - if (target->HasUnitState(UNIT_STAT_ISOLATED)) + if (target->HasUnitState(UNIT_STATE_ISOLATED)) { SendTickImmune(target, caster); return; @@ -6638,7 +6638,7 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons if (!target->isAlive() || !target->GetMaxPower(powerType)) return; - if (target->HasUnitState(UNIT_STAT_ISOLATED)) + if (target->HasUnitState(UNIT_STATE_ISOLATED)) { SendTickImmune(target, caster); return; @@ -6670,7 +6670,7 @@ void AuraEffect::HandlePeriodicPowerBurnAuraTick(Unit* target, Unit* caster) con if (!caster || !target->isAlive() || target->getPowerType() != powerType) return; - if (target->HasUnitState(UNIT_STAT_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) + if (target->HasUnitState(UNIT_STATE_ISOLATED) || target->IsImmunedToDamage(GetSpellInfo())) { SendTickImmune(target, caster); return; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index b32e346757f..f0e9213bf84 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -2342,7 +2342,7 @@ void UnitAura::FillTargetMap(std::map & targets, Unit* caster) { float radius = GetSpellInfo()->Effects[effIndex].CalcRadius(caster); - if (!GetUnitOwner()->HasUnitState(UNIT_STAT_ISOLATED)) + if (!GetUnitOwner()->HasUnitState(UNIT_STATE_ISOLATED)) { switch (GetSpellInfo()->Effects[effIndex].Effect) { diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 3c73edb880d..84ed06ca509 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1447,7 +1447,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, const uint32 effectMask, bool return SPELL_MISS_EVADE; // assisting case, healing and resurrection - if (unit->HasUnitState(UNIT_STAT_ATTACK_PLAYER)) + if (unit->HasUnitState(UNIT_STATE_ATTACK_PLAYER)) { m_caster->SetContestedPvP(); if (m_caster->GetTypeId() == TYPEID_PLAYER) @@ -3214,8 +3214,8 @@ void Spell::cast(bool skipCheck) m_spellState = SPELL_STATE_DELAYED; SetDelayStart(0); - if (m_caster->HasUnitState(UNIT_STAT_CASTING) && !m_caster->IsNonMeleeSpellCasted(false, false, true)) - m_caster->ClearUnitState(UNIT_STAT_CASTING); + if (m_caster->HasUnitState(UNIT_STATE_CASTING) && !m_caster->IsNonMeleeSpellCasted(false, false, true)) + m_caster->ClearUnitState(UNIT_STATE_CASTING); } else { @@ -3581,8 +3581,8 @@ void Spell::finish(bool ok) if (m_spellInfo->IsChanneled()) m_caster->UpdateInterruptMask(); - if (m_caster->HasUnitState(UNIT_STAT_CASTING) && !m_caster->IsNonMeleeSpellCasted(false, false, true)) - m_caster->ClearUnitState(UNIT_STAT_CASTING); + if (m_caster->HasUnitState(UNIT_STATE_CASTING) && !m_caster->IsNonMeleeSpellCasted(false, false, true)) + m_caster->ClearUnitState(UNIT_STATE_CASTING); // Unsummon summon as possessed creatures on spell cancel if (m_spellInfo->IsChanneled() && m_caster->GetTypeId() == TYPEID_PLAYER) @@ -5000,7 +5000,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (strict && m_caster->IsScriptOverriden(m_spellInfo, 6953)) m_caster->RemoveMovementImpairingAuras(); } - if (m_caster->HasUnitState(UNIT_STAT_ROOT)) + if (m_caster->HasUnitState(UNIT_STATE_ROOT)) return SPELL_FAILED_ROOTED; break; } @@ -5228,7 +5228,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; Unit* target = m_targets.GetUnitTarget(); - if (m_caster == target && m_caster->HasUnitState(UNIT_STAT_ROOT)) + if (m_caster == target && m_caster->HasUnitState(UNIT_STATE_ROOT)) { if (m_caster->GetTypeId() == TYPEID_PLAYER) return SPELL_FAILED_ROOTED; @@ -5455,7 +5455,7 @@ SpellCastResult Spell::CheckCast(bool strict) SpellCastResult Spell::CheckPetCast(Unit* target) { - if (m_caster->HasUnitState(UNIT_STAT_CASTING) && !(_triggeredCastFlags & TRIGGERED_IGNORE_CAST_IN_PROGRESS)) //prevent spellcast interruption by another spellcast + if (m_caster->HasUnitState(UNIT_STATE_CASTING) && !(_triggeredCastFlags & TRIGGERED_IGNORE_CAST_IN_PROGRESS)) //prevent spellcast interruption by another spellcast return SPELL_FAILED_SPELL_IN_PROGRESS; // dead owner (pets still alive when owners ressed?) diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index d5a9bf923b4..60ad61fce68 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1338,7 +1338,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) } //Any effect which causes you to lose control of your character will supress the starfall effect. - if (m_caster->HasUnitState(UNIT_STAT_CONTROLLED)) + if (m_caster->HasUnitState(UNIT_STATE_CONTROLLED)) return; m_caster->CastSpell(unitTarget, damage, true); @@ -3360,11 +3360,11 @@ void Spell::EffectDistract(SpellEffIndex /*effIndex*/) return; // target must be OK to do this - if (unitTarget->HasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING)) + if (unitTarget->HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_STUNNED | UNIT_STATE_FLEEING)) return; unitTarget->SetFacingTo(unitTarget->GetAngle(m_targets.GetDst())); - unitTarget->ClearUnitState(UNIT_STAT_MOVING); + unitTarget->ClearUnitState(UNIT_STATE_MOVING); if (unitTarget->GetTypeId() == TYPEID_UNIT) unitTarget->GetMotionMaster()->MoveDistract(damage * IN_MILLISECONDS); @@ -6426,7 +6426,7 @@ void Spell::EffectSummonDeadPet(SpellEffIndex /*effIndex*/) pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); pet->setDeathState(ALIVE); - pet->ClearUnitState(uint32(UNIT_STAT_ALL_STATE)); + pet->ClearUnitState(uint32(UNIT_STATE_ALL_STATE)); pet->SetHealth(pet->CountPctFromMaxHealth(damage)); //pet->AIM_Initialize(); diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index fb8018fb5ae..556516ecfb0 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1604,7 +1604,7 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, Unit const* target, b } // not allow casting on flying player - if (target->HasUnitState(UNIT_STAT_IN_FLIGHT)) + if (target->HasUnitState(UNIT_STATE_IN_FLIGHT)) return SPELL_FAILED_BAD_TARGETS; if (TargetAuraState && !target->HasAuraState(AuraStateType(TargetAuraState), this, caster)) diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp index 442fd025423..ff17e989cd9 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_drakkisath.cpp @@ -76,7 +76,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp index 0edcdfece15..0d8cabcf89c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_gyth.cpp @@ -105,7 +105,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp index 3a7461f90c4..a944ee6daf8 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_halycon.cpp @@ -82,7 +82,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp index 6f5b9079268..bc9de52d91d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_highlord_omokk.cpp @@ -85,7 +85,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp index cac07469d68..973ffe7e53b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_mother_smolderweb.cpp @@ -77,7 +77,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp index 0975b171f4d..b7492998d56 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_overlord_wyrmthalak.cpp @@ -101,7 +101,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp index 96cc6e75e4e..d76d0d7f47c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -74,7 +74,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp index 470d41208dc..4fb7e513f5d 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_quartermaster_zigris.cpp @@ -72,7 +72,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp index 70b2a415a24..ce19a03571a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_rend_blackhand.cpp @@ -73,7 +73,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp index 20eefd5a0bc..f93466cbece 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_shadow_hunter_voshgajin.cpp @@ -74,7 +74,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp index 77152277742..88a09d57138 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_the_beast.cpp @@ -73,7 +73,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp index 9f06c2fbd5d..2dc05799e51 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_warmaster_voone.cpp @@ -82,7 +82,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp index 5222270df1a..2c7cd73c604 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_victor_nefarius.cpp @@ -351,7 +351,7 @@ public: //Teleport self to a hiding spot (this causes errors in the Trinity log but no real issues) DoTeleportTo(HIDE_X, HIDE_Y, HIDE_Z); - me->AddUnitState(UNIT_STAT_FLEEING); + me->AddUnitState(UNIT_STATE_FLEEING); //Spawn nef and have him attack a random target Creature* Nefarian = me->SummonCreature(CREATURE_NEFARIAN, NEF_X, NEF_Y, NEF_Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index a6d7248cc26..14add92fd16 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -393,7 +393,7 @@ public: EnfeebleResetTimer = 0; } else EnfeebleResetTimer -= diff; - if (me->HasUnitState(UNIT_STAT_STUNNED)) // While shifting to phase 2 malchezaar stuns himself + if (me->HasUnitState(UNIT_STATE_STUNNED)) // While shifting to phase 2 malchezaar stuns himself return; if (me->GetUInt64Value(UNIT_FIELD_TARGET) != me->getVictim()->GetGUID()) diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp index 3959a01e4ba..f792b861c99 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_baron_geddon.cpp @@ -80,7 +80,7 @@ class boss_baron_geddon : public CreatureScript return; } - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp index e1bb48dfbb0..a9d32ebca9a 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_garr.cpp @@ -71,7 +71,7 @@ class boss_garr : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp index 9bbbb086abd..7261bbf1fbd 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_gehennas.cpp @@ -68,7 +68,7 @@ class boss_gehennas : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp index 1ba143a8c03..84e9957a60c 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_golemagg.cpp @@ -91,7 +91,7 @@ class boss_golemagg : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp index 5395b46fef3..e3e04002112 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_lucifron.cpp @@ -68,7 +68,7 @@ class boss_lucifron : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp index 5551531379b..65a630a58f7 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_magmadar.cpp @@ -80,7 +80,7 @@ class boss_magmadar : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp index d324150c22f..862a980394a 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp @@ -116,7 +116,7 @@ class boss_majordomo : public CreatureScript return; } - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (HealthBelowPct(50)) diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp index 97c89f12b5b..f696ec58e1b 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_shazzrah.cpp @@ -73,7 +73,7 @@ class boss_shazzrah : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp index ccefca70d67..9f511c1394a 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp @@ -84,7 +84,7 @@ class boss_sulfuron : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -169,7 +169,7 @@ class mob_flamewaker_priest : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index cb7f0de165d..337eea13438 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -425,7 +425,7 @@ public: { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->AddUnitState(UNIT_STAT_STUNNED); + me->AddUnitState(UNIT_STATE_STUNNED); ScriptedAI::InitializeAI(); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp index 2004eec71bc..9b5d941589b 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_muru.cpp @@ -151,7 +151,7 @@ public: summoned->CastSpell(summoned, SPELL_DARKFIEND_VISUAL, false); break; case CREATURE_DARKNESS: - summoned->AddUnitState(UNIT_STAT_STUNNED); + summoned->AddUnitState(UNIT_STATE_STUNNED); float x, y, z, o; summoned->GetHomePosition(x, y, z, o); me->SummonCreature(CREATURE_DARK_FIENDS, x, y, z, o, TEMPSUMMON_CORPSE_DESPAWN, 0); @@ -399,7 +399,7 @@ public: InAction = false; SummonSentinel = false; - me->AddUnitState(UNIT_STAT_STUNNED); + me->AddUnitState(UNIT_STATE_STUNNED); Summons.DespawnAll(); } @@ -472,7 +472,7 @@ public: WaitTimer = 2000; InAction = false; - me->AddUnitState(UNIT_STAT_STUNNED); + me->AddUnitState(UNIT_STATE_STUNNED); } void SpellHit(Unit* /*caster*/, const SpellInfo* Spell) @@ -491,7 +491,7 @@ public: { if (!InAction) { - me->ClearUnitState(UNIT_STAT_STUNNED); + me->ClearUnitState(UNIT_STATE_STUNNED); DoCastAOE(SPELL_DARKFIEND_SKIN, false); AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)); InAction = true; @@ -599,7 +599,7 @@ public: SpellTimer = 5000; Phase = 0; - me->AddUnitState(UNIT_STAT_STUNNED); + me->AddUnitState(UNIT_STATE_STUNNED); DoCastAOE(SPELL_BLACKHOLE_SPAWN, true); } @@ -611,7 +611,7 @@ public: switch (NeedForAHack) { case 0: - me->ClearUnitState(UNIT_STAT_STUNNED); + me->ClearUnitState(UNIT_STATE_STUNNED); DoCastAOE(SPELL_BLACKHOLE_GROW, false); if (Victim) AttackStart(Victim); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp index 3cb0cc2120a..bd6f6ec4748 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_venoxis.cpp @@ -173,7 +173,7 @@ class boss_venoxis : public CreatureScript events.Update(diff); // return back to main code if we're still casting - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp index b295780cfc9..36a1ff1bade 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp @@ -75,7 +75,7 @@ class boss_kurinnaxx : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp index 3dc7660985f..a290b07e60f 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp @@ -127,7 +127,7 @@ class boss_moam : public CreatureScript } // Messing up mana-drain channel - //if (me->HasUnitState(UNIT_STAT_CASTING)) + //if (me->HasUnitState(UNIT_STATE_CASTING)) // return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp index ea137026ec2..afa8eff5823 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp @@ -93,7 +93,7 @@ class boss_rajaxx : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index a60c33a4feb..b03d2dc3a4a 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -90,7 +90,7 @@ struct boss_twinemperorsAI : public ScriptedAI AfterTeleportTimer = 0; Abuse_Bug_Timer = urand(10000, 17000); BugsTimer = 2000; - me->ClearUnitState(UNIT_STAT_STUNNED); + me->ClearUnitState(UNIT_STATE_STUNNED); DontYellWhenDead = false; EnrageTimer = 15*60000; } @@ -234,7 +234,7 @@ struct boss_twinemperorsAI : public ScriptedAI DoStopAttack(); DoResetThreat(); DoCast(me, SPELL_TWIN_TELEPORT_VISUAL); - me->AddUnitState(UNIT_STAT_STUNNED); + me->AddUnitState(UNIT_STATE_STUNNED); AfterTeleport = true; AfterTeleportTimer = 2000; tspellcasted = false; @@ -246,9 +246,9 @@ struct boss_twinemperorsAI : public ScriptedAI { if (!tspellcasted) { - me->ClearUnitState(UNIT_STAT_STUNNED); + me->ClearUnitState(UNIT_STATE_STUNNED); DoCast(me, SPELL_TWIN_TELEPORT); - me->AddUnitState(UNIT_STAT_STUNNED); + me->AddUnitState(UNIT_STATE_STUNNED); } tspellcasted = true; @@ -256,7 +256,7 @@ struct boss_twinemperorsAI : public ScriptedAI if (AfterTeleportTimer <= diff) { AfterTeleport = false; - me->ClearUnitState(UNIT_STAT_STUNNED); + me->ClearUnitState(UNIT_STATE_STUNNED); if (Unit* nearu = me->SelectNearestTarget(100)) { //DoYell(nearu->GetName(), LANG_UNIVERSAL, 0); diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp index bf22c7a5d30..f1eaa0c87c5 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_herald_volazj.cpp @@ -115,7 +115,7 @@ public: DoCast(me, INSANITY_VISUAL, true); // Unattackable me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetControlled(true, UNIT_STAT_STUNNED); + me->SetControlled(true, UNIT_STATE_STUNNED); } // phase mask target->CastSpell(target, SPELL_INSANITY_TARGET+insanityHandled, true); @@ -171,7 +171,7 @@ public: // Cleanup Summons.DespawnAll(); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetControlled(false, UNIT_STAT_STUNNED); + me->SetControlled(false, UNIT_STATE_STUNNED); } void EnterCombat(Unit* /*who*/) @@ -271,7 +271,7 @@ public: insanityHandled = 0; me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetControlled(false, UNIT_STAT_STUNNED); + me->SetControlled(false, UNIT_STATE_STUNNED); me->RemoveAurasDueToSpell(INSANITY_VISUAL); } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index cf9c7fd0f3d..79a102c803f 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -283,7 +283,7 @@ public: if (((UndergroundPhase == 0 && HealthBelowPct(75)) || (UndergroundPhase == 1 && HealthBelowPct(50)) || (UndergroundPhase == 2 && HealthBelowPct(25))) - && !me->HasUnitState(UNIT_STAT_CASTING)) + && !me->HasUnitState(UNIT_STATE_CASTING)) { GuardianSummoned = false; VenomancerSummoned = false; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp index 61d74c431fe..e848c29c466 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp @@ -174,7 +174,7 @@ class boss_baltharus_the_warborn : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING) && !(events.GetPhaseMask() & PHASE_INTRO_MASK)) + if (me->HasUnitState(UNIT_STATE_CASTING) && !(events.GetPhaseMask() & PHASE_INTRO_MASK)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -268,7 +268,7 @@ class npc_baltharus_the_warborn_clone : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp index 3b3b1fb9f47..851a56009f6 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp @@ -148,7 +148,7 @@ class boss_general_zarithrian : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -257,7 +257,7 @@ class npc_onyx_flamecaller : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp index 724fd4ef011..78810e27b05 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp @@ -137,7 +137,7 @@ class boss_saviana_ragefire : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index 153e128e58d..0848d1e9524 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -111,7 +111,7 @@ public: { RemoveSummons(); me->SetDisplayId(me->GetNativeDisplayId()); - me->ClearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + me->ClearUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED); bEventInProgress = false; bEvent = false; @@ -167,7 +167,7 @@ public: uiPhase++; uiResurrectTimer = 4000; bEventInProgress = false; - me->ClearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + me->ClearUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED); } else uiResurrectTimer -= uiDiff; } @@ -211,14 +211,14 @@ public: if (!bSummonArmy) { bSummonArmy = true; - me->AddUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + me->AddUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED); DoCast(me, SPELL_ARMY_DEAD); } if (!bDeathArmyDone) { if (uiDeathArmyCheckTimer <= uiDiff) { - me->ClearUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + me->ClearUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED); uiDeathArmyCheckTimer = 0; bDeathArmyDone = true; } else uiDeathArmyCheckTimer -= uiDiff; @@ -263,7 +263,7 @@ public: } } - if (!me->HasUnitState(UNIT_STAT_ROOT) && !me->HealthBelowPct(1)) + if (!me->HasUnitState(UNIT_STATE_ROOT) && !me->HealthBelowPct(1)) DoMeleeAttackIfReady(); } @@ -273,7 +273,7 @@ public: { uiDamage = 0; me->SetHealth(0); - me->AddUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED); + me->AddUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED); RemoveSummons(); switch (uiPhase) { diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp index a0d6f04f44c..4a28ebe6495 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp @@ -142,7 +142,7 @@ class boss_bronjahm : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp index fb39019fb84..ad49f6cbce8 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp @@ -260,7 +260,7 @@ class boss_devourer_of_souls : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp index c6d00a95de3..c8f18dba1d0 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp @@ -441,7 +441,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -497,7 +497,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -555,7 +555,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -612,7 +612,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -672,7 +672,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -738,7 +738,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -811,7 +811,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -878,7 +878,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp index 673362f59a0..9cfcb78f6f1 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_falric.cpp @@ -103,7 +103,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; switch (events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp index b074c309cb3..a9bfb603794 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/boss_marwyn.cpp @@ -100,7 +100,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; switch (events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index e1ae8374278..1583bdbdcd4 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -659,7 +659,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -742,7 +742,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -842,7 +842,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -912,7 +912,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -978,7 +978,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index 26ece7db662..0f9495d4928 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -190,7 +190,7 @@ class boss_garfrost : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index 8bcd0b8b8e2..8e211cbd2cb 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -215,7 +215,7 @@ class boss_ick : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index 91be62a33e7..25cd292d390 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -72,7 +72,7 @@ class mob_ymirjar_flamebearer : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) @@ -187,7 +187,7 @@ class mob_wrathbone_laborer : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp index 9abcc669f09..11614708d99 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp @@ -212,7 +212,7 @@ class boss_drakkari_colossus : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -289,7 +289,7 @@ class boss_drakkari_elemental : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -335,7 +335,7 @@ class boss_drakkari_elemental : public CreatureScript damage = 0; // to prevent spell spaming - if (me->HasUnitState(UNIT_STAT_CHARGING)) + if (me->HasUnitState(UNIT_STATE_CHARGING)) return; // not sure about this, the idea of this code is to prevent bug the elemental diff --git a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp index 46070090063..daa5ee86483 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_gal_darah.cpp @@ -148,7 +148,7 @@ public: DoScriptText(SAY_TRANSFORM_1, me); uiTransformationTimer = 5*IN_MILLISECONDS; bStartOfTransformation = true; - me->ClearUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); + me->ClearUnitState(UNIT_STATE_STUNNED|UNIT_STATE_ROOT); me->SetReactState(REACT_AGGRESSIVE); } else @@ -158,7 +158,7 @@ public: if (bStartOfTransformation) { bStartOfTransformation = false; - me->AddUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); + me->AddUnitState(UNIT_STATE_STUNNED|UNIT_STATE_ROOT); me->SetReactState(REACT_PASSIVE); } } @@ -191,7 +191,7 @@ public: DoScriptText(SAY_TRANSFORM_2, me); uiTransformationTimer = 9*IN_MILLISECONDS; bStartOfTransformation = true; - me->ClearUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); + me->ClearUnitState(UNIT_STATE_STUNNED|UNIT_STATE_ROOT); me->SetReactState(REACT_AGGRESSIVE); } else @@ -201,7 +201,7 @@ public: if (bStartOfTransformation) { bStartOfTransformation = false; - me->AddUnitState(UNIT_STAT_STUNNED|UNIT_STAT_ROOT); + me->AddUnitState(UNIT_STATE_STUNNED|UNIT_STATE_ROOT); me->SetReactState(REACT_PASSIVE); } } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 94a3da2672b..ca86e4cef60 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -287,7 +287,7 @@ class boss_blood_council_controller : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -535,7 +535,7 @@ class boss_prince_keleseth_icc : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -753,7 +753,7 @@ class boss_prince_taldaram_icc : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -990,7 +990,7 @@ class boss_prince_valanar_icc : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -1179,7 +1179,7 @@ class npc_ball_of_flame : public CreatureScript if (Player* target = ObjectAccessor::GetPlayer(*me, _chaseGUID)) { // need to clear states now because this call is before AuraEffect is fully removed - me->ClearUnitState(UNIT_STAT_CASTING | UNIT_STAT_STUNNED); + me->ClearUnitState(UNIT_STATE_CASTING | UNIT_STATE_STUNNED); if (target && me->Attack(target, true)) me->GetMotionMaster()->MoveChase(target, 1.0f); } @@ -1316,7 +1316,7 @@ class npc_dark_nucleus : public CreatureScript } DoCast(who, SPELL_SHADOW_RESONANCE_RESIST); - me->ClearUnitState(UNIT_STAT_CASTING); + me->ClearUnitState(UNIT_STATE_CASTING); } void MoveInLineOfSight(Unit* who) @@ -1350,7 +1350,7 @@ class npc_dark_nucleus : public CreatureScript !victim->HasAura(SPELL_SHADOW_RESONANCE_RESIST, me->GetGUID())) { DoCast(victim, SPELL_SHADOW_RESONANCE_RESIST); - me->ClearUnitState(UNIT_STAT_CASTING); + me->ClearUnitState(UNIT_STATE_CASTING); } } else @@ -1369,7 +1369,7 @@ class npc_dark_nucleus : public CreatureScript _lockedTarget = true; AttackStart(victim); DoCast(victim, SPELL_SHADOW_RESONANCE_RESIST); - me->ClearUnitState(UNIT_STAT_CASTING); + me->ClearUnitState(UNIT_STATE_CASTING); } } } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index d775e5778f7..79a577f6591 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -321,7 +321,7 @@ class boss_blood_queen_lana_thel : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 31b3786a360..ace5f07a2f8 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -403,7 +403,7 @@ class boss_deathbringer_saurfang : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp index f90bc5d445e..a97c6f7d138 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -169,7 +169,7 @@ class boss_festergut : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -305,7 +305,7 @@ class npc_stinky_icc : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index af9bc3f43a3..ea2f73e788f 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -410,7 +410,7 @@ class boss_lady_deathwhisper : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING) && !(events.GetPhaseMask() & PHASE_INTRO_MASK)) + if (me->HasUnitState(UNIT_STATE_CASTING) && !(events.GetPhaseMask() & PHASE_INTRO_MASK)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -665,7 +665,7 @@ class npc_cult_fanatic : public CreatureScript Events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = Events.ExecuteEvent()) @@ -743,7 +743,7 @@ class npc_cult_adherent : public CreatureScript Events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = Events.ExecuteEvent()) @@ -888,7 +888,7 @@ class npc_darnavan : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (_canShatter && me->getVictim() && me->getVictim()->IsImmunedToDamage(SPELL_SCHOOL_MASK_NORMAL)) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index ac246abdc7c..1672d8b2d87 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -154,7 +154,7 @@ class boss_lord_marrowgar : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index cf22338995b..a4c814e5789 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -519,7 +519,7 @@ class boss_professor_putricide : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -796,7 +796,7 @@ class spell_putricide_ooze_channel : public SpellScriptLoader void StartAttack() { - GetCaster()->ClearUnitState(UNIT_STAT_CASTING); + GetCaster()->ClearUnitState(UNIT_STATE_CASTING); GetCaster()->ToCreature()->AI()->AttackStart(GetHitUnit()); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index a4cd96aa9f6..9649b6c8ef8 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -169,7 +169,7 @@ class boss_rotface : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -384,7 +384,7 @@ class npc_precious_icc : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 3d3eaa1cc87..bab58094468 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -379,7 +379,7 @@ class boss_sindragosa : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -663,7 +663,7 @@ class npc_spinestalker : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) @@ -783,7 +783,7 @@ class npc_rimefang : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) @@ -911,7 +911,7 @@ class npc_sindragosa_trash : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 5029dbcceee..f3750f38dd5 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -701,7 +701,7 @@ class boss_the_lich_king : public CreatureScript summon->CastSpell(summon, SPELL_ICE_SPHERE, false); summon->CastSpell(summon, SPELL_ICE_BURST_TARGET_SEARCH, false); summon->CastSpell(target, SPELL_ICE_PULSE, false); - summon->ClearUnitState(UNIT_STAT_CASTING); + summon->ClearUnitState(UNIT_STATE_CASTING); summon->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f); } else @@ -861,7 +861,7 @@ class boss_the_lich_king : public CreatureScript events.Update(diff); // during Remorseless Winter phases The Lich King is channeling a spell, but we must continue casting other spells - if (me->HasUnitState(UNIT_STAT_CASTING) && !(events.GetPhaseMask() & PHASE_MASK_NO_CAST_CHECK)) + if (me->HasUnitState(UNIT_STATE_CASTING) && !(events.GetPhaseMask() & PHASE_MASK_NO_CAST_CHECK)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -966,14 +966,14 @@ class boss_the_lich_king : public CreatureScript break; case EVENT_QUAKE: events.SetPhase(PHASE_TWO); - me->ClearUnitState(UNIT_STAT_CASTING); // clear state to ensure check in DoCastAOE passes + me->ClearUnitState(UNIT_STATE_CASTING); // clear state to ensure check in DoCastAOE passes DoCastAOE(SPELL_QUAKE); SendMusicToPlayers(MUSIC_SPECIAL); Talk(SAY_LK_QUAKE); break; case EVENT_QUAKE_2: events.SetPhase(PHASE_THREE); - me->ClearUnitState(UNIT_STAT_CASTING); // clear state to ensure check in DoCastAOE passes + me->ClearUnitState(UNIT_STATE_CASTING); // clear state to ensure check in DoCastAOE passes DoCastAOE(SPELL_QUAKE); SendMusicToPlayers(MUSIC_SPECIAL); Talk(SAY_LK_QUAKE); @@ -1059,7 +1059,7 @@ class boss_the_lich_king : public CreatureScript break; case EVENT_OUTRO_RAISE_DEAD: DoCastAOE(SPELL_RAISE_DEAD); - me->ClearUnitState(UNIT_STAT_CASTING); + me->ClearUnitState(UNIT_STATE_CASTING); SendMusicToPlayers(MUSIC_FINAL); break; case EVENT_OUTRO_TALK_5: @@ -1071,7 +1071,7 @@ class boss_the_lich_king : public CreatureScript Talk(SAY_LK_OUTRO_6); if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) tirion->SetFacingToObject(me); - me->ClearUnitState(UNIT_STAT_CASTING); + me->ClearUnitState(UNIT_STATE_CASTING); DoCastAOE(SPELL_SUMMON_BROKEN_FROSTMOURNE_3); SetEquipmentSlots(false, EQUIP_UNEQUIP); break; @@ -1255,7 +1255,7 @@ class npc_tirion_fordring_tft : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) @@ -1349,7 +1349,7 @@ class npc_shambling_horror_icc : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) @@ -1429,7 +1429,7 @@ class npc_raging_spirit : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) @@ -1498,7 +1498,7 @@ class npc_valkyr_shadowguard : public CreatureScript _events.Reset(); DoCastAOE(SPELL_EJECT_ALL_PASSENGERS); me->GetMotionMaster()->MoveTargetedHome(); - me->ClearUnitState(UNIT_STAT_EVADE); + me->ClearUnitState(UNIT_STATE_EVADE); } } @@ -1564,7 +1564,7 @@ class npc_valkyr_shadowguard : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 96072ad0e83..e0993178890 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -426,7 +426,7 @@ class boss_valithria_dreamwalker : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) @@ -626,7 +626,7 @@ class npc_the_lich_king_controller : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) @@ -741,7 +741,7 @@ class npc_risen_archmage : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) @@ -807,7 +807,7 @@ class npc_blazing_skeleton : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) @@ -873,7 +873,7 @@ class npc_suppresser : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; // this code will never be reached while channeling @@ -967,7 +967,7 @@ class npc_gluttonous_abomination : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 6bd8f3cba7d..112e23c4691 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -611,7 +611,7 @@ class npc_rotting_frost_giant : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) @@ -874,7 +874,7 @@ class boss_sister_svalna : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -1130,7 +1130,7 @@ class npc_crok_scourgebane : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) @@ -1353,7 +1353,7 @@ class npc_captain_arnath : public CreatureScript Events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = Events.ExecuteEvent()) @@ -1434,7 +1434,7 @@ class npc_captain_brandon : public CreatureScript Events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = Events.ExecuteEvent()) @@ -1502,7 +1502,7 @@ class npc_captain_grondel : public CreatureScript Events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = Events.ExecuteEvent()) @@ -1567,7 +1567,7 @@ class npc_captain_rupert : public CreatureScript Events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = Events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp index 95f07ac212a..058c5b35e3a 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_faerlina.cpp @@ -137,7 +137,7 @@ class boss_faerlina : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index 2964cb5a699..47151ef6d80 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -342,7 +342,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 4c0efc4ac98..26e4b33ad8a 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -400,7 +400,7 @@ class boss_gothik : public CreatureScript instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE); } - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index f70f36e77a3..161c9160293 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -486,7 +486,7 @@ public: else uiGuardiansOfIcecrownTimer -= diff; } - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (uint32 eventId = events.GetEvent()) diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index be9168c6fd4..acdb2355841 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -248,7 +248,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 052fa3ba4a5..6dfa62df2d1 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -523,7 +523,7 @@ public: return; // We can't cast if we are casting already. - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp index fe00f5b97d8..bb75b789fff 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp @@ -95,7 +95,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp index b86e04f55bb..ab814a2ca22 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp @@ -200,7 +200,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index 28b606c19e1..8de2945af30 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -101,7 +101,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp index 2c7532fcf70..eadc524348b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp @@ -283,7 +283,7 @@ class boss_steelbreaker : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -404,7 +404,7 @@ class boss_runemaster_molgeim : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -649,7 +649,7 @@ class boss_stormcaller_brundir : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp index 10ff3db96c7..1c478cd83e9 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_auriaya.cpp @@ -217,7 +217,7 @@ class boss_auriaya : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -348,7 +348,7 @@ class npc_sanctum_sentry : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -418,7 +418,7 @@ class npc_feral_defender : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index d96790c3e37..47f74b1ddba 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -384,7 +384,7 @@ class boss_flame_leviathan : public CreatureScript return; } - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -425,7 +425,7 @@ class boss_flame_leviathan : public CreatureScript break; case EVENT_REPAIR: me->MonsterTextEmote(EMOTE_REPAIR, 0, true); - me->ClearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); + me->ClearUnitState(UNIT_STATE_STUNNED | UNIT_STATE_ROOT); events.ScheduleEvent(EVENT_SHUTDOWN, 150*IN_MILLISECONDS); events.CancelEvent(EVENT_REPAIR); break; @@ -1576,7 +1576,7 @@ class spell_systems_shutdown : public SpellScriptLoader return; //! This could probably in the SPELL_EFFECT_SEND_EVENT handler too: - owner->AddUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT); + owner->AddUnitState(UNIT_STATE_STUNNED | UNIT_STATE_ROOT); owner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); owner->RemoveAurasDueToSpell(SPELL_GATHERING_SPEED); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index f62c2d6c596..1f4fc8d3938 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -401,7 +401,7 @@ class boss_freya : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -739,7 +739,7 @@ class boss_elder_brightleaf : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -872,7 +872,7 @@ class boss_elder_stonebark : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -985,7 +985,7 @@ class boss_elder_ironbranch : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index 0013a970380..c7918f85245 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp @@ -138,7 +138,7 @@ class boss_general_vezax : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -336,7 +336,7 @@ class boss_saronite_animus : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp index 918a401143a..33f50d0b3de 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp @@ -370,7 +370,7 @@ class boss_hodir : public CreatureScript me->StopMoving(); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveIdle(); - me->SetControlled(true, UNIT_STAT_STUNNED); + me->SetControlled(true, UNIT_STATE_STUNNED); me->CombatStop(true); me->setFaction(35); @@ -387,7 +387,7 @@ class boss_hodir : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -612,12 +612,12 @@ class npc_hodir_priest : public CreatureScript void UpdateAI(uint32 const diff) { - if (!UpdateVictim() || me->HasUnitState(UNIT_STAT_STUNNED) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED)) + if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED)) return; events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (HealthBelowPct(30)) @@ -688,12 +688,12 @@ class npc_hodir_shaman : public CreatureScript void UpdateAI(uint32 const diff) { - if (!UpdateVictim() || me->HasUnitState(UNIT_STAT_STUNNED) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED)) + if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED)) return; events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -750,12 +750,12 @@ class npc_hodir_druid : public CreatureScript void UpdateAI(uint32 const diff) { - if (!UpdateVictim() || me->HasUnitState(UNIT_STAT_STUNNED) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED)) + if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED)) return; events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -825,12 +825,12 @@ class npc_hodir_mage : public CreatureScript void UpdateAI(uint32 const diff) { - if (!UpdateVictim() || me->HasUnitState(UNIT_STAT_STUNNED) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED)) + if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_STUNNED) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED)) return; events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp index e72cf395a0d..d8a3ef0b8df 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_ignis.cpp @@ -202,7 +202,7 @@ class boss_ignis : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index 1fd8430abd8..a156e6ef08b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -224,7 +224,7 @@ class boss_kologarn : public CreatureScript summon->CastSpell(summon, SPELL_FOCUSED_EYEBEAM_VISUAL, true); summon->SetReactState(REACT_PASSIVE); // One of the above spells is a channeled spell, we need to clear this unit state for MoveChase to work - summon->ClearUnitState(UNIT_STAT_CASTING); + summon->ClearUnitState(UNIT_STATE_CASTING); // Victim gets 67351 if (eyebeamTarget) @@ -244,7 +244,7 @@ class boss_kologarn : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index 8f09ab26a0a..724eb45d586 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -263,7 +263,7 @@ class boss_xt002 : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index 0c59097a9ec..43a848c6b16 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -229,7 +229,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index 94a133c78a6..8a6d7f80818 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -252,7 +252,7 @@ public: events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 5c1ec15030c..989e1e57453 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -535,7 +535,7 @@ public: void UpdateAI(const uint32 diff) { - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (paralyzeTimer <= diff) @@ -663,7 +663,7 @@ class npc_scourge_hulk : public CreatureScript if (mightyBlow <= diff) { if (Unit* victim = me->getVictim()) - if (!victim->HasUnitState(UNIT_STAT_STUNNED)) // Prevent knocking back a ritual player + if (!victim->HasUnitState(UNIT_STATE_STUNNED)) // Prevent knocking back a ritual player DoCast(victim, SPELL_MIGHTY_BLOW); mightyBlow = urand(12000, 17000); } diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp index 1cc681b0133..bffc6af2a3a 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_archavon.cpp @@ -81,7 +81,7 @@ class boss_archavon : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -161,7 +161,7 @@ class mob_archavon_warder : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp index 973e7a2844c..2f4079d4e3c 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp @@ -120,7 +120,7 @@ class boss_emalon : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -221,7 +221,7 @@ class mob_tempest_minion : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (Aura const* overchargedAura = me->GetAura(SPELL_OVERCHARGED)) diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp index a545a6ae14c..dd9db1c0a99 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_koralon.cpp @@ -79,7 +79,7 @@ class boss_koralon : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp index 4b92b54b0d3..162f59fa5b7 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_toravon.cpp @@ -80,7 +80,7 @@ class boss_toravon : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) @@ -148,7 +148,7 @@ class mob_frost_warder : public CreatureScript events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (events.ExecuteEvent() == EVENT_FROST_BLAST) diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp index b6e01d3188e..11fb0933b9b 100644 --- a/src/server/scripts/Northrend/borean_tundra.cpp +++ b/src/server/scripts/Northrend/borean_tundra.cpp @@ -1328,7 +1328,7 @@ public: if (uiType != POINT_MOTION_TYPE) return; - me->AddUnitState(UNIT_STAT_STUNNED); + me->AddUnitState(UNIT_STATE_STUNNED); me->CastSpell(me, SPELL_STUN, true); if (me->isSummon()) if (Unit* summoner = me->ToTempSummon()->GetSummoner()) @@ -1445,7 +1445,7 @@ public: DoScriptText(SAY_LERYSSA_1, pLeryssa); pArlos->Kill(pArlos, false); pLeryssa->RemoveAura(SPELL_STUN); - pLeryssa->ClearUnitState(UNIT_STAT_STUNNED); + pLeryssa->ClearUnitState(UNIT_STATE_STUNNED); pLeryssa->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); pLeryssa->GetMotionMaster()->MovePoint(0, 3722.114502f, 3564.201660f, 477.441437f); @@ -1495,7 +1495,7 @@ public: if (Creature* pTalbot = me->FindNearestCreature(NPC_PRINCE_VALANAR, 50.0f, true)) CAST_AI(npc_counselor_talbot::npc_counselor_talbotAI, pTalbot->GetAI())->bCheck = true; - me->AddUnitState(UNIT_STAT_STUNNED); + me->AddUnitState(UNIT_STATE_STUNNED); me->CastSpell(me, SPELL_STUN, true); if (me->isSummon()) diff --git a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp index a8d1f22bd00..d359917ab28 100644 --- a/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp +++ b/src/server/scripts/Outland/Auchindoun/AuchenaiCrypts/boss_shirrak_the_dead_watcher.cpp @@ -82,7 +82,7 @@ public: summoned->CastSpell(summoned, SPELL_FOCUS_FIRE_VISUAL, false); summoned->setFaction(me->getFaction()); summoned->SetLevel(me->getLevel()); - summoned->AddUnitState(UNIT_STAT_ROOT); + summoned->AddUnitState(UNIT_STATE_ROOT); if (Unit* pFocusedTarget = Unit::GetUnit(*me, FocusedTargetGUID)) summoned->AI()->AttackStart(pFocusedTarget); diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index 71e773042b7..ecea5e6abb4 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -337,7 +337,7 @@ class boss_vazruden_the_herald : public CreatureScript VazrudenGUID = 0; } summoned = false; - me->ClearUnitState(UNIT_STAT_ROOT); + me->ClearUnitState(UNIT_STATE_ROOT); me->SetVisible(true); } } @@ -352,7 +352,7 @@ class boss_vazruden_the_herald : public CreatureScript NazanGUID = Nazan->GetGUID(); summoned = true; me->SetVisible(false); - me->AddUnitState(UNIT_STAT_ROOT); + me->AddUnitState(UNIT_STATE_ROOT); } } diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index 1679efb5525..1f17e9e4802 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -253,7 +253,7 @@ class boss_magtheridon : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - me->AddUnitState(UNIT_STAT_STUNNED); + me->AddUnitState(UNIT_STATE_STUNNED); DoCast(me, SPELL_SHADOW_CAGE_C, true); } @@ -334,7 +334,7 @@ class boss_magtheridon : public CreatureScript void AttackStart(Unit* who) { - if (!me->HasUnitState(UNIT_STAT_STUNNED)) + if (!me->HasUnitState(UNIT_STATE_STUNNED)) ScriptedAI::AttackStart(who); } @@ -388,7 +388,7 @@ class boss_magtheridon : public CreatureScript if (BlastNova_Timer <= diff) { // to avoid earthquake interruption - if (!me->HasUnitState(UNIT_STAT_STUNNED)) + if (!me->HasUnitState(UNIT_STATE_STUNNED)) { DoScriptText(EMOTE_BLASTNOVA, me); DoCast(me, SPELL_BLASTNOVA); @@ -431,7 +431,7 @@ class boss_magtheridon : public CreatureScript if (!Phase3 && HealthBelowPct(30) && !me->IsNonMeleeSpellCasted(false) // blast nova - && !me->HasUnitState(UNIT_STAT_STUNNED)) // shadow cage and earthquake + && !me->HasUnitState(UNIT_STATE_STUNNED)) // shadow cage and earthquake { Phase3 = true; DoScriptText(SAY_CHAMBER_DESTROY, me); diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp index 9d52a0a3e87..caaedc4c51b 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp @@ -223,7 +223,7 @@ class instance_magtheridons_lair : public InstanceMapScript Creature* Magtheridon = instance->GetCreature(MagtheridonGUID); if (Magtheridon && Magtheridon->isAlive()) { - Magtheridon->ClearUnitState(UNIT_STAT_STUNNED); + Magtheridon->ClearUnitState(UNIT_STATE_STUNNED); Magtheridon->AI()->AttackStart(Magtheridon->SelectNearestTarget(999)); } CageTimer = 0; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index a45576f8884..904b2851816 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -397,7 +397,7 @@ class boss_kaelthas : public CreatureScript void MoveInLineOfSight(Unit* who) { - if (!me->HasUnitState(UNIT_STAT_STUNNED) && me->canCreatureAttack(who)) + if (!me->HasUnitState(UNIT_STATE_STUNNED) && me->canCreatureAttack(who)) { if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; diff --git a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp index 4a83181159c..2f6e0823da1 100644 --- a/src/server/scripts/Outland/boss_doomlord_kazzak.cpp +++ b/src/server/scripts/Outland/boss_doomlord_kazzak.cpp @@ -110,7 +110,7 @@ class boss_doomlord_kazzak : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) diff --git a/src/server/scripts/Outland/boss_doomwalker.cpp b/src/server/scripts/Outland/boss_doomwalker.cpp index 883601632b8..c4bd232cc85 100644 --- a/src/server/scripts/Outland/boss_doomwalker.cpp +++ b/src/server/scripts/Outland/boss_doomwalker.cpp @@ -103,7 +103,7 @@ class boss_doomwalker : public CreatureScript _events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = _events.ExecuteEvent()) diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp index c27ad8e7948..668db2efcbb 100644 --- a/src/server/scripts/Outland/nagrand.cpp +++ b/src/server/scripts/Outland/nagrand.cpp @@ -632,7 +632,7 @@ public: if (!UpdateVictim()) return; - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (ChainLightningTimer <= diff) diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp index efebf7dfe94..79811069402 100644 --- a/src/server/scripts/Outland/netherstorm.cpp +++ b/src/server/scripts/Outland/netherstorm.cpp @@ -796,7 +796,7 @@ public: Materialize = true; } - if (me->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || me->HasUnitState(UNIT_STAT_ROOT)) // if the mob is rooted/slowed by spells eg.: Entangling Roots, Frost Nova, Hamstring, Crippling Poison, etc. => remove it + if (me->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED) || me->HasUnitState(UNIT_STATE_ROOT)) // if the mob is rooted/slowed by spells eg.: Entangling Roots, Frost Nova, Hamstring, Crippling Poison, etc. => remove it DoCast(me, SPELL_PHASE_SLIP); if (!UpdateVictim()) diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp index e4c4e020b0f..07de7fe4786 100644 --- a/src/server/scripts/Outland/shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/shadowmoon_valley.cpp @@ -1195,7 +1195,7 @@ public: AggroTargetGUID = 0; Timers = false; - me->AddUnitState(UNIT_STAT_ROOT); + me->AddUnitState(UNIT_STATE_ROOT); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetTarget(0); } @@ -1239,7 +1239,7 @@ public: if (Player* AggroTarget = (Unit::GetPlayer(*me, AggroTargetGUID))) { me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->ClearUnitState(UNIT_STAT_ROOT); + me->ClearUnitState(UNIT_STATE_ROOT); float x, y, z; AggroTarget->GetPosition(x, y, z); diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index d266b42f50a..d3e484d80ab 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -224,7 +224,7 @@ public: { Unit* target = GetTarget(); target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - target->AddUnitState(UNIT_STAT_ROOT); + target->AddUnitState(UNIT_STATE_ROOT); } void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp index 9deecea01ba..9f652e7a859 100644 --- a/src/server/scripts/World/boss_emerald_dragons.cpp +++ b/src/server/scripts/World/boss_emerald_dragons.cpp @@ -144,7 +144,7 @@ struct emerald_dragonAI : public WorldBossAI events.Update(diff); - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; while (uint32 eventId = events.ExecuteEvent()) diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 9227c0c1138..fcf5f56c539 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1910,7 +1910,7 @@ public: Unit* owner = me->GetCharmerOrOwner(); me->CombatStop(true); - if (owner && !me->HasUnitState(UNIT_STAT_FOLLOW)) + if (owner && !me->HasUnitState(UNIT_STATE_FOLLOW)) { me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); @@ -2069,7 +2069,7 @@ public: void Reset() { - me->SetControlled(true, UNIT_STAT_STUNNED);//disable rotate + me->SetControlled(true, UNIT_STATE_STUNNED);//disable rotate me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);//imune to knock aways like blast wave ResetTimer = 5000; @@ -2101,8 +2101,8 @@ public: if (!UpdateVictim()) return; - if (!me->HasUnitState(UNIT_STAT_STUNNED)) - me->SetControlled(true, UNIT_STAT_STUNNED);//disable rotate + if (!me->HasUnitState(UNIT_STATE_STUNNED)) + me->SetControlled(true, UNIT_STATE_STUNNED);//disable rotate if (Entry != NPC_ADVANCED_TARGET_DUMMY && Entry != NPC_TARGET_DUMMY) { @@ -2203,7 +2203,7 @@ public: if (!UpdateVictim()) return; - if (me->HasUnitState(UNIT_STAT_CASTING)) + if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (FireShield_Timer <= diff) -- cgit v1.2.3 From c7ea952a4795c959b1d1de02c2cb5e498d6391aa Mon Sep 17 00:00:00 2001 From: QAston Date: Fri, 3 Feb 2012 18:46:05 +0100 Subject: Core/Entities: Rename UNIT_FLAG_OOC_NOT_ATTACKABLE and UNIT_FLAG_PASSIVE to UNIT_FLAG_IMMUNE_TO_PC and UNIT_FLAG_IMMUNE_TO_NPC respectively. New names tell much more about what those flags do. --- .../game/Battlegrounds/Zones/BattlegroundIC.cpp | 6 +++--- src/server/game/Entities/Creature/Creature.cpp | 4 ++-- src/server/game/Entities/Player/Player.cpp | 2 +- src/server/game/Entities/Unit/Unit.cpp | 20 +++++++++--------- src/server/game/Entities/Unit/Unit.h | 4 ++-- src/server/game/Spells/SpellEffects.cpp | 2 +- .../BlackrockDepths/boss_tomb_of_seven.cpp | 4 ++-- .../BlackrockDepths/instance_blackrock_depths.cpp | 2 +- .../EasternKingdoms/Karazhan/bosses_opera.cpp | 2 +- .../EasternKingdoms/ScarletEnclave/chapter1.cpp | 8 ++++---- .../EasternKingdoms/ScarletEnclave/chapter2.cpp | 24 +++++++++++----------- .../ShadowfangKeep/instance_shadowfang_keep.cpp | 2 +- .../scripts/EasternKingdoms/tirisfal_glades.cpp | 8 ++++---- .../CullingOfStratholme/culling_of_stratholme.cpp | 14 ++++++------- .../Kalimdor/WailingCaverns/wailing_caverns.cpp | 4 ++-- src/server/scripts/Kalimdor/dustwallow_marsh.cpp | 6 +++--- src/server/scripts/Kalimdor/moonglade.cpp | 4 ++-- .../scripts/Kalimdor/stonetalon_mountains.cpp | 2 +- src/server/scripts/Kalimdor/tanaris.cpp | 2 +- .../AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp | 4 ++-- .../RubySanctum/boss_general_zarithrian.cpp | 2 +- .../RubySanctum/instance_ruby_sanctum.cpp | 4 ++-- .../TrialOfTheChampion/boss_grand_champions.cpp | 12 +++++------ .../TrialOfTheCrusader/boss_anubarak_trial.cpp | 6 +++--- .../TrialOfTheCrusader/boss_faction_champions.cpp | 4 ++-- .../TrialOfTheCrusader/boss_twin_valkyr.cpp | 6 +++--- .../Northrend/DraktharonKeep/boss_novos.cpp | 8 ++++---- .../Northrend/Gundrak/boss_drakkari_colossus.cpp | 8 ++++---- .../IcecrownCitadel/boss_blood_prince_council.cpp | 12 +++++------ .../IcecrownCitadel/boss_deathbringer_saurfang.cpp | 8 ++++---- .../IcecrownCitadel/boss_professor_putricide.cpp | 2 +- .../Northrend/IcecrownCitadel/boss_sindragosa.cpp | 4 ++-- .../IcecrownCitadel/boss_the_lich_king.cpp | 4 ++-- .../Northrend/IcecrownCitadel/icecrown_citadel.cpp | 8 ++++---- .../scripts/Northrend/Naxxramas/boss_thaddius.cpp | 8 ++++---- .../Northrend/Nexus/Nexus/boss_keristrasza.cpp | 4 ++-- .../scripts/Northrend/Nexus/Oculus/boss_varos.cpp | 6 +++--- .../scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp | 2 +- .../UtgardeKeep/boss_ingvar_the_plunderer.cpp | 2 +- .../UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp | 12 +++++------ .../scripts/Northrend/VioletHold/boss_erekem.cpp | 8 ++++---- .../scripts/Northrend/VioletHold/boss_ichoron.cpp | 2 +- .../Northrend/VioletHold/boss_lavanthor.cpp | 2 +- .../scripts/Northrend/VioletHold/boss_moragg.cpp | 2 +- .../scripts/Northrend/VioletHold/boss_xevozz.cpp | 2 +- .../scripts/Northrend/VioletHold/boss_zuramat.cpp | 2 +- .../Northrend/VioletHold/instance_violet_hold.cpp | 18 ++++++++-------- .../scripts/Northrend/VioletHold/violet_hold.cpp | 2 +- src/server/scripts/Northrend/grizzly_hills.cpp | 6 +++--- src/server/scripts/Northrend/zuldrak.cpp | 12 +++++------ .../scripts/Outland/BlackTemple/boss_illidan.cpp | 2 +- .../SerpentShrine/boss_lurker_below.cpp | 8 ++++---- .../MagtheridonsLair/boss_magtheridon.cpp | 2 +- .../arcatraz/boss_harbinger_skyriss.cpp | 4 ++-- src/server/scripts/Spells/spell_quest.cpp | 4 ++-- src/server/scripts/World/item_scripts.cpp | 2 +- 56 files changed, 162 insertions(+), 162 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index e3eefd41d52..40f31cef394 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -175,9 +175,9 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff) { if (siege->isAlive()) { - if (siege->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_UNK_14|UNIT_FLAG_OOC_NOT_ATTACKABLE)) + if (siege->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_UNK_14|UNIT_FLAG_IMMUNE_TO_PC)) // following sniffs the vehicle always has UNIT_FLAG_UNK_14 - siege->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_OOC_NOT_ATTACKABLE); + siege->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_IMMUNE_TO_PC); else siege->SetHealth(siege->GetMaxHealth()); } @@ -793,7 +793,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) if (Creature* siegeEngine = GetBGCreature(siegeType)) { - siegeEngine->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_UNK_14|UNIT_FLAG_OOC_NOT_ATTACKABLE); + siegeEngine->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_UNK_14|UNIT_FLAG_IMMUNE_TO_PC); siegeEngine->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]); } } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index d29fb5bdad6..c338dbbdd78 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1413,7 +1413,7 @@ bool Creature::canStartAttack(Unit const* who, bool force) const if (isCivilian()) return false; - if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)) + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) return false; // Do not attack non-combat pets @@ -1905,7 +1905,7 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction / if (isCivilian()) return false; - if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PASSIVE)) + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_NPC)) return false; // skip fighting creature diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 697e225815a..41062d5b978 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3251,7 +3251,7 @@ void Player::InitStatsForLevel(bool reapplyMods) // cleanup unit flags (will be re-applied if need at aura load). RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_ATTACKABLE_1 | - UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE | UNIT_FLAG_LOOTING | + UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_LOOTING | UNIT_FLAG_PET_IN_COMBAT | UNIT_FLAG_SILENCED | UNIT_FLAG_PACIFIED | UNIT_FLAG_STUNNED | UNIT_FLAG_IN_COMBAT | UNIT_FLAG_DISARMED | UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING | UNIT_FLAG_NOT_SELECTABLE | diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a513c1dd929..8a407ab9b2d 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -11986,7 +11986,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy) if (IsAIEnabled) { creature->AI()->EnterCombat(enemy); - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); // always remove Out of Combat Non Attackable flag if we enter combat and AI is enabled + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); // always remove Out of Combat Non Attackable flag if we enter combat and AI is enabled } if (creature->GetFormation()) creature->GetFormation()->MemberAttackStart(creature, enemy); @@ -12018,8 +12018,8 @@ void Unit::ClearInCombat() // Player's state will be cleared in Player::UpdateContestedPvP if (Creature* creature = ToCreature()) { - if (creature->GetCreatureInfo() && creature->GetCreatureInfo()->unit_flags & UNIT_FLAG_OOC_NOT_ATTACKABLE) - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); // re-apply Out of Combat Non Attackable flag if we leave combat, can be overriden in scripts in EnterEvadeMode() + if (creature->GetCreatureInfo() && creature->GetCreatureInfo()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC) + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); // re-apply Out of Combat Non Attackable flag if we leave combat, can be overriden in scripts in EnterEvadeMode() ClearUnitState(UNIT_STATE_ATTACK_PLAYER); if (HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED)) @@ -12047,7 +12047,7 @@ bool Unit::isTargetableForAttack(bool checkFakeDeath) const return false; if (HasFlag(UNIT_FIELD_FLAGS, - UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE)) + UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC)) return false; if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->isGameMaster()) @@ -12100,10 +12100,10 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co } // check flags if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_TAXI_FLIGHT | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_UNK_16) - || (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)) - || (!target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)) - || (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE)) - || (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE))) + || (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) + || (!target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) + || (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) + || (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))) return false; // CvC case - can attack each other only when one of them is hostile @@ -12191,12 +12191,12 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co { if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) { - if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE)) + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) return false; } else { - if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)) + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) return false; } } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index bb2ab7b9e2d..ae376b81df9 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -589,8 +589,8 @@ enum UnitFlags UNIT_FLAG_PREPARATION = 0x00000020, // don't take reagents for spells with SPELL_ATTR5_NO_REAGENT_WHILE_PREP UNIT_FLAG_UNK_6 = 0x00000040, UNIT_FLAG_NOT_ATTACKABLE_1 = 0x00000080, // ?? (UNIT_FLAG_PVP_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1) is NON_PVP_ATTACKABLE - UNIT_FLAG_OOC_NOT_ATTACKABLE = 0x00000100, // 2.0.8 - (OOC Out Of Combat) Can not be attacked when not in combat. Removed if unit for some reason enter combat. - UNIT_FLAG_PASSIVE = 0x00000200, // makes you unable to attack everything. Almost identical to our "civilian"-term. Will ignore it's surroundings and not engage in combat unless "called upon" or engaged by another unit. + UNIT_FLAG_IMMUNE_TO_PC = 0x00000100, // disables actions by PlayerCharacters (PC) on unit - see Unit::_IsValidAttackTarget, Unit::_IsValidAssistTarget + UNIT_FLAG_IMMUNE_TO_NPC = 0x00000200, // disables actions by NonPlayerCharacters (NPC) on unit - see Unit::_IsValidAttackTarget, Unit::_IsValidAssistTarget UNIT_FLAG_LOOTING = 0x00000400, // loot animation UNIT_FLAG_PET_IN_COMBAT = 0x00000800, // in combat?, 2.0.8 UNIT_FLAG_PVP = 0x00001000, // changed in 3.0.3 diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 60ad61fce68..8153901b73b 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3093,7 +3093,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) summon->SelectLevel(summon->GetCreatureInfo()); // some summoned creaters have different from 1 DB data for level/hp summon->SetUInt32Value(UNIT_NPC_FLAGS, summon->GetCreatureInfo()->npcflag); - summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE); + summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); summon->AI()->EnterEvadeMode(); break; diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp index 6b474166e7f..3c8d5fc4fa8 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/boss_tomb_of_seven.cpp @@ -117,7 +117,7 @@ public: player->CLOSE_GOSSIP_MENU(); //start event here creature->setFaction(FACTION_HOSTILE); - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); creature->AI()->AttackStart(player); InstanceScript* instance = creature->GetInstanceScript(); if (instance) @@ -165,7 +165,7 @@ public: me->setFaction(FACTION_FRIEND); // was set before event start, so set again - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); if (instance) { diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp index f87d87d976c..2ef3ef48ecb 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp @@ -375,7 +375,7 @@ public: if (Creature* boss = instance->GetCreature(TombBossGUIDs[TombEventCounter])) { boss->setFaction(FACTION_HOSTILE); - boss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + boss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); if (Unit* target = boss->SelectNearestTarget(500)) boss->AI()->AttackStart(target); } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index a675c355cfc..b15cb7d3da1 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -655,7 +655,7 @@ public: { DoScriptText(RAND(SAY_CRONE_AGGRO, SAY_CRONE_AGGRO2), me); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } void JustDied(Unit* /*killer*/) diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index a7d1c3ad8ba..a2c8a890feb 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -125,7 +125,7 @@ public: phase = PHASE_CHAINED; events.Reset(); me->setFaction(7); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); me->LoadEquipment(0, true); } @@ -230,7 +230,7 @@ public: else { me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); phase = PHASE_ATTACKING; if (Player* target = Unit::GetPlayer(*me, playerGUID)) @@ -378,7 +378,7 @@ public: return true; } - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); int32 uiSayId = rand()% (sizeof(m_auiRandomSay)/sizeof(int32)); @@ -877,7 +877,7 @@ public: { npc_scarlet_miner_cartAI(Creature* c) : PassiveAI(c), minerGUID(0) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetDisplayId(me->GetCreatureInfo()->Modelid1); // Modelid2 is a horse. } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index 1fb8287e54d..4583a33a196 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -264,7 +264,7 @@ public: m_uiValrothGUID = summoned->GetGUID(); summoned->AddThreat(me, 0.0f); - summoned->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + summoned->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } void SummonAcolyte(uint32 uiAmount) @@ -605,7 +605,7 @@ public: ExecuteSpeech_Counter = 0; PlayerGUID = 0; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } bool MeetQuestCondition(Unit* player) @@ -702,7 +702,7 @@ public: case 9: DoScriptText(SAY_EXEC_TIME_6, me, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; case 11: @@ -730,7 +730,7 @@ public: case 9: DoScriptText(SAY_EXEC_TIME_8, me, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; case 11: @@ -758,7 +758,7 @@ public: case 9: DoScriptText(SAY_EXEC_TIME_3, me, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; case 11: @@ -786,7 +786,7 @@ public: case 9: DoScriptText(SAY_EXEC_TIME_7, me, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; case 11: @@ -814,7 +814,7 @@ public: case 9: DoScriptText(SAY_EXEC_TIME_4, me, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; case 11: @@ -842,7 +842,7 @@ public: case 9: DoScriptText(SAY_EXEC_TIME_9, me, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; case 11: @@ -870,7 +870,7 @@ public: case 9: DoScriptText(SAY_EXEC_TIME_5, me, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; case 11: @@ -898,7 +898,7 @@ public: case 9: DoScriptText(SAY_EXEC_TIME_10, me, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; case 11: @@ -926,7 +926,7 @@ public: case 9: DoScriptText(SAY_EXEC_TIME_1, me, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; case 11: @@ -954,7 +954,7 @@ public: case 9: DoScriptText(SAY_EXEC_TIME_2, me, player); me->SetStandState(UNIT_STAND_STATE_KNEEL); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; case 10: DoScriptText(SAY_EXEC_WAITING, me, player); break; case 11: diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp index df369bb58b6..57b902ac6d4 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp @@ -252,7 +252,7 @@ public: { case 1: summon = pArchmage->SummonCreature(pArchmage->GetEntry(), SpawnLocation[4], TEMPSUMMON_TIMED_DESPAWN, 10000); - summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); summon->SetReactState(REACT_DEFENSIVE); summon->CastSpell(summon, SPELL_ASHCROMBE_TELEPORT, true); DoScriptText(SAY_ARCHMAGE, summon); diff --git a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp index 6cbf28f171c..0d72ab6fb2f 100644 --- a/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp +++ b/src/server/scripts/EasternKingdoms/tirisfal_glades.cpp @@ -53,7 +53,7 @@ public: if (quest->GetQuestId() == QUEST_590) { creature->setFaction(FACTION_HOSTILE); - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); CAST_AI(npc_calvin_montague::npc_calvin_montagueAI, creature->AI())->AttackStart(player); } return true; @@ -80,8 +80,8 @@ public: me->RestoreFaction(); - if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE)) - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + if (!me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } void EnterCombat(Unit* /*who*/) {} @@ -101,7 +101,7 @@ public: uiDamage = 0; me->RestoreFaction(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->CombatStop(true); m_uiPhase = 1; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index 6cdb794bf5e..9518abd1635 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -414,7 +414,7 @@ public: if (Creature* temp = me->SummonCreature((uint32)RiftAndSpawnsLocations[i][0], RiftAndSpawnsLocations[timeRiftID][1], RiftAndSpawnsLocations[timeRiftID][2], RiftAndSpawnsLocations[timeRiftID][3], RiftAndSpawnsLocations[timeRiftID][4], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000)) { guidVector[i-timeRiftID-1] = temp->GetGUID(); - temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE); + temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); temp->SetReactState(REACT_PASSIVE); temp->GetMotionMaster()->MovePoint(0, RiftAndSpawnsLocations[i][1], RiftAndSpawnsLocations[i][2], RiftAndSpawnsLocations[i][3]); if ((uint32)RiftAndSpawnsLocations[i][0] == NPC_EPOCH) @@ -1003,7 +1003,7 @@ public: { pDisguised2->UpdateEntry(NPC_INFINITE_HUNTER, 0); //Make them unattackable - pDisguised2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE); + pDisguised2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); pDisguised2->SetReactState(REACT_PASSIVE); } JumpToNextStep(2000); @@ -1013,7 +1013,7 @@ public: { pDisguised1->UpdateEntry(NPC_INFINITE_AGENT, 0); //Make them unattackable - pDisguised1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE); + pDisguised1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); pDisguised1->SetReactState(REACT_PASSIVE); } JumpToNextStep(2000); @@ -1023,7 +1023,7 @@ public: { pDisguised0->UpdateEntry(NPC_INFINITE_ADVERSARY, 0); //Make them unattackable - pDisguised0->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE); + pDisguised0->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); pDisguised0->SetReactState(REACT_PASSIVE); } JumpToNextStep(2000); @@ -1037,7 +1037,7 @@ public: for (uint32 i = 0; i< ENCOUNTER_DRACONIAN_NUMBER; ++i) if (Creature* temp = Unit::GetCreature(*me, uiInfiniteDraconianGUID[i])) { - temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE); + temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); temp->SetReactState(REACT_AGGRESSIVE); } JumpToNextStep(5000); @@ -1095,7 +1095,7 @@ public: if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID)) { //Make Epoch attackable - pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE); + pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); pEpoch->SetReactState(REACT_AGGRESSIVE); } @@ -1150,7 +1150,7 @@ public: case 87: if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) { - pMalganis->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_6 | UNIT_FLAG_PASSIVE | UNIT_FLAG_UNK_15); + pMalganis->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_UNK_6 | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_UNK_15); pMalganis->SetReactState(REACT_AGGRESSIVE); } JumpToNextStep(1000); diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp index 1155d353371..8eb3d20d528 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp @@ -98,7 +98,7 @@ public: DoScriptText(SAY_MAKE_PREPARATIONS, creature); creature->setFaction(250); - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); CAST_AI(npc_escortAI, (creature->AI()))->Start(false, false, player->GetGUID()); CAST_AI(npc_escortAI, (creature->AI()))->SetDespawnAtFar(false); @@ -143,7 +143,7 @@ public: currentEvent = 0; eventProgress = 0; me->setActive(true); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } uint32 eventTimer; diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index 0ead5d95447..eede1aa069a 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -176,7 +176,7 @@ public: creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); creature->SetSpeed(MOVE_RUN, creature->GetSpeedRate(MOVE_RUN), true); creature->setFaction(35); - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NON_ATTACKABLE); + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NON_ATTACKABLE); creature->SetReactState(REACT_PASSIVE); creature->GetMotionMaster()->MovePoint(1, DeserterDisappearPos); break; @@ -198,7 +198,7 @@ public: void Reset() { me->RestoreFaction(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NON_ATTACKABLE); me->SetReactState(REACT_AGGRESSIVE); me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } @@ -531,7 +531,7 @@ public: return; me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); SetCombatMovement(true); if (me->isInCombat()) diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp index f9e4bce34d0..2d6e34ab9ee 100644 --- a/src/server/scripts/Kalimdor/moonglade.cpp +++ b/src/server/scripts/Kalimdor/moonglade.cpp @@ -602,7 +602,7 @@ public: { npc_omenAI(Creature* creature) : ScriptedAI(creature) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->GetMotionMaster()->MovePoint(1, 7549.977f, -2855.137f, 456.9678f); } @@ -616,7 +616,7 @@ public: if (pointId == 1) { me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); if (Player* player = me->SelectNearestPlayer(40.0f)) AttackStart(player); } diff --git a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp index 3dd0d1cbf02..c31a7731865 100644 --- a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp +++ b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp @@ -154,7 +154,7 @@ public: DoScriptText(SAY_START, creature); creature->setFaction(113); - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } return true; } diff --git a/src/server/scripts/Kalimdor/tanaris.cpp b/src/server/scripts/Kalimdor/tanaris.cpp index 394a32e5cb6..ff6cdccb66a 100644 --- a/src/server/scripts/Kalimdor/tanaris.cpp +++ b/src/server/scripts/Kalimdor/tanaris.cpp @@ -410,7 +410,7 @@ public: creature->setFaction(113); creature->SetFullHealth(); creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); DoScriptText(SAY_OOX_START, creature); if (npc_escortAI* pEscortAI = CAST_AI(npc_OOX17::npc_OOX17AI, creature->AI())) diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index 1e3a9a7a177..0f4b046f7d5 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -82,7 +82,7 @@ public: boss_taldaramAI(Creature* c) : ScriptedAI(c) { instance = c->GetInstanceScript(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } @@ -314,7 +314,7 @@ public: { if (!instance) return; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->RemoveAurasDueToSpell(SPELL_BEAM_VISUAL); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp index 851a56009f6..f41522f844d 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_general_zarithrian.cpp @@ -97,7 +97,7 @@ class boss_general_zarithrian : public CreatureScript { _Reset(); if (instance->GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE && instance->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } void EnterCombat(Unit* /*who*/) diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp index 0fb51df7ed9..f9e302d7634 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp @@ -189,7 +189,7 @@ class instance_ruby_sanctum : public InstanceMapScript { HandleGameObject(FlameWallsGUID, true); if (Creature* zarithrian = instance->GetCreature(GeneralZarithrianGUID)) - zarithrian->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + zarithrian->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); } break; } @@ -199,7 +199,7 @@ class instance_ruby_sanctum : public InstanceMapScript { HandleGameObject(FlameWallsGUID, true); if (Creature* zarithrian = instance->GetCreature(GeneralZarithrianGUID)) - zarithrian->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + zarithrian->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); } break; } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index ebdc55c51b7..9fcfcfa47e5 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -107,7 +107,7 @@ void AggroAllPlayers(Creature* temp) if (player->isAlive()) { - temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); temp->SetReactState(REACT_AGGRESSIVE); temp->SetInCombatWith(player); player->SetInCombatWith(temp); @@ -320,7 +320,7 @@ public: me->SetReactState(REACT_PASSIVE); // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); } InstanceScript* instance; @@ -453,7 +453,7 @@ public: me->SetReactState(REACT_PASSIVE); // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); } InstanceScript* instance; @@ -592,7 +592,7 @@ public: me->SetReactState(REACT_PASSIVE); // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); } InstanceScript* instance; @@ -739,7 +739,7 @@ public: me->SetReactState(REACT_PASSIVE); // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); } InstanceScript* instance; @@ -895,7 +895,7 @@ public: me->SetReactState(REACT_PASSIVE); // THIS IS A HACK, SHOULD BE REMOVED WHEN THE EVENT IS FULL SCRIPTED - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); } InstanceScript* instance; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index d3d92375d39..a9e41d90899 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -535,7 +535,7 @@ public: { me->RemoveAurasDueToSpell(SPELL_SUBMERGE_EFFECT); DoCast(me, SPELL_EMERGE_EFFECT); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); me->CombatStart(me->SelectNearestTarget()); } else @@ -543,7 +543,7 @@ public: if (!me->HasAura(SPELL_PERMAFROST_HELPER)) { DoCast(me, SPELL_SUBMERGE_EFFECT); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); me->CombatStop(); } } @@ -647,7 +647,7 @@ public: void Reset() { // For an unknown reason this npc isn't recognize the Aura of Permafrost with this flags =/ - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); m_uiTargetGUID = 0; } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index 45fdbdd5616..2fe0bd3f397 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -172,7 +172,7 @@ public: { Summons.Summon(temp); temp->SetReactState(REACT_PASSIVE); - temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); if (playerTeam == ALLIANCE) { temp->SetHomePosition(vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 0); @@ -203,7 +203,7 @@ public: if (Creature* temp = Unit::GetCreature(*me, *i)) { temp->SetReactState(REACT_AGGRESSIVE); - temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); } } break; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 960b685f700..c1009963df0 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -172,7 +172,7 @@ struct boss_twin_baseAI : public ScriptedAI uint32 m_uiTouchSpellId; void Reset() { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); me->ModifyAuraState(m_uiAuraState, true); /* Uncomment this once that they are flying above the ground @@ -205,7 +205,7 @@ struct boss_twin_baseAI : public ScriptedAI { case 1: m_instance->DoUseDoorOrButton(m_instance->GetData64(GO_MAIN_GATE_DOOR)); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); break; } @@ -572,7 +572,7 @@ struct mob_unleashed_ballAI : public ScriptedAI void Reset() { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); me->SetFlying(true); diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp index 54e234a6d87..5418cf8c4d0 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp @@ -100,8 +100,8 @@ public: lSummons.DespawnAll(); crystalHandlerAmount = 0; - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE)) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) @@ -136,7 +136,7 @@ public: } instance->SetData(DATA_NOVOS_EVENT, IN_PROGRESS); } - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } @@ -227,7 +227,7 @@ public: if (luiCrystals.empty()) { me->CastStop(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Phase = PHASE_2; diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp index 11614708d99..b66c3d795f3 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp @@ -97,7 +97,7 @@ class boss_drakkari_colossus : public CreatureScript if (GetData(DATA_INTRO_DONE)) { me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->RemoveAura(SPELL_FREEZE_ANIM); } @@ -149,7 +149,7 @@ class boss_drakkari_colossus : public CreatureScript me->GetMotionMaster()->MoveIdle(); me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); DoCast(me, SPELL_FREEZE_ANIM); break; case ACTION_UNFREEZE_COLOSSUS: @@ -158,7 +158,7 @@ class boss_drakkari_colossus : public CreatureScript return; me->SetReactState(REACT_AGGRESSIVE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->RemoveAura(SPELL_FREEZE_ANIM); me->SetInCombatWithZone(); @@ -172,7 +172,7 @@ class boss_drakkari_colossus : public CreatureScript void DamageTaken(Unit* /*attacker*/, uint32& damage) { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE)) + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) damage = 0; if (phase == COLOSSUS_PHASE_NORMAL || diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index ca86e4cef60..f5e207a9442 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -383,7 +383,7 @@ class boss_prince_keleseth_icc : public CreatureScript events.Reset(); summons.DespawnAll(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); _isEmpowered = false; me->SetHealth(_spawnHealth); instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, uint32(true)); @@ -489,7 +489,7 @@ class boss_prince_keleseth_icc : public CreatureScript { case ACTION_STAND_UP: me->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS); // was in sniff. don't ask why @@ -607,7 +607,7 @@ class boss_prince_taldaram_icc : public CreatureScript events.Reset(); summons.DespawnAll(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); _isEmpowered = false; me->SetHealth(_spawnHealth); instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, uint32(true)); @@ -707,7 +707,7 @@ class boss_prince_taldaram_icc : public CreatureScript { case ACTION_STAND_UP: me->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS); // was in sniff. don't ask why @@ -830,7 +830,7 @@ class boss_prince_valanar_icc : public CreatureScript events.Reset(); summons.DespawnAll(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); _isEmpowered = false; me->SetHealth(me->GetMaxHealth()); instance->SetData(DATA_ORB_WHISPERER_ACHIEVEMENT, uint32(true)); @@ -944,7 +944,7 @@ class boss_prince_valanar_icc : public CreatureScript { case ACTION_STAND_UP: me->RemoveAurasDueToSpell(SPELL_FEIGN_DEATH); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS); // was in sniff. don't ask why diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index ace5f07a2f8..3c795187f43 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -279,7 +279,7 @@ class boss_deathbringer_saurfang : public CreatureScript events.Reset(); events.SetPhase(PHASE_COMBAT); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); if (!_introDone) { DoCast(me, SPELL_GRIP_OF_AGONY); @@ -314,7 +314,7 @@ class boss_deathbringer_saurfang : public CreatureScript void AttackStart(Unit* victim) { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE)) + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) return; ScriptedAI::AttackStart(victim); @@ -324,7 +324,7 @@ class boss_deathbringer_saurfang : public CreatureScript { ScriptedAI::EnterEvadeMode(); if (_introDone) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } void JustReachedHome() @@ -434,7 +434,7 @@ class boss_deathbringer_saurfang : public CreatureScript case EVENT_INTRO_FINISH: events.SetPhase(PHASE_COMBAT); _introDone = true; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); break; case EVENT_SUMMON_BLOOD_BEAST: for (uint32 i10 = 0; i10 < 2; ++i10) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index a4c814e5789..28964a28d78 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -196,7 +196,7 @@ class boss_professor_putricide : public CreatureScript me->GetMotionMaster()->MovementExpired(); if (instance->GetBossState(DATA_ROTFACE) == DONE && instance->GetBossState(DATA_FESTERGUT) == DONE) - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE); } void EnterCombat(Unit* who) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index bab58094468..fb04d9ce7a4 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -749,7 +749,7 @@ class npc_rimefang : public CreatureScript me->setActive(true); me->SetSpeed(MOVE_FLIGHT, 2.0f); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); float moveTime = me->GetExactDist(&RimefangFlyPos) / (me->GetSpeed(MOVE_FLIGHT) * 0.001f); me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, RimefangLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250)); me->SetDefaultMovementType(IDLE_MOTION_TYPE); @@ -768,7 +768,7 @@ class npc_rimefang : public CreatureScript me->SetFlying(false); me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); me->SetHomePosition(RimefangLandPos); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } void EnterCombat(Unit* /*victim*/) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index f3750f38dd5..9866d2aace0 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -902,7 +902,7 @@ class boss_the_lich_king : public CreatureScript break; case EVENT_FINISH_INTRO: me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetReactState(REACT_AGGRESSIVE); events.SetPhase(PHASE_ONE); break; @@ -1825,7 +1825,7 @@ class npc_terenas_menethil : public CreatureScript if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) { lichKing->AI()->DoAction(ACTION_FINISH_OUTRO); - lichKing->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); + lichKing->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC); if (Creature* tirion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) tirion->AI()->AttackStart(lichKing); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 112e23c4691..d02d8f3f316 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -809,7 +809,7 @@ class boss_sister_svalna : public CreatureScript case ACTION_START_GAUNTLET: me->setActive(true); _isEventInProgress = true; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); events.ScheduleEvent(EVENT_SVALNA_START, 25000); break; case ACTION_RESURRECT_CAPTAINS: @@ -843,7 +843,7 @@ class boss_sister_svalna : public CreatureScript _isEventInProgress = false; me->setActive(false); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); me->SetFlying(false); } @@ -1680,7 +1680,7 @@ class spell_icc_stoneform : public SpellScriptLoader if (Creature* target = GetTarget()->ToCreature()) { target->SetReactState(REACT_PASSIVE); - target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); target->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_CUSTOM_SPELL_02); } } @@ -1690,7 +1690,7 @@ class spell_icc_stoneform : public SpellScriptLoader if (Creature* target = GetTarget()->ToCreature()) { target->SetReactState(REACT_AGGRESSIVE); - target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC); target->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); } } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index acdb2355841..7977fa4df8a 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -132,12 +132,12 @@ public: if (!checkFeugenAlive && !checkStalaggAlive) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); me->SetReactState(REACT_AGGRESSIVE); } else { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); me->SetReactState(REACT_PASSIVE); } } @@ -179,13 +179,13 @@ public: if (!checkFeugenAlive && !checkStalaggAlive) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); // REACT_AGGRESSIVE only reset when he takes damage. DoZoneInCombat(); } else { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED); me->SetReactState(REACT_PASSIVE); } } diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp index 6a57444893f..44c6c25fa3e 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp @@ -144,14 +144,14 @@ public: { if (remove) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (me->HasAura(SPELL_FROZEN_PRISON)) me->RemoveAurasDueToSpell(SPELL_FROZEN_PRISON); } else { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); DoCast(me, SPELL_FROZEN_PRISON, false); } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index 8de2945af30..8852338c362 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -256,10 +256,10 @@ class spell_varos_centrifuge_shield : public SpellScriptLoader { // flags taken from sniffs // UNIT_FLAG_UNK_9 -> means passive but it is not yet implemented in core - if (caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_PASSIVE|UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_UNK_6)) + if (caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_UNK_6)) { caster->ToCreature()->SetReactState(REACT_PASSIVE); - caster->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_PASSIVE|UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_UNK_6); + caster->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_UNK_6); } } } @@ -269,7 +269,7 @@ class spell_varos_centrifuge_shield : public SpellScriptLoader if (Unit* caster = GetCaster()) { caster->ToCreature()->SetReactState(REACT_AGGRESSIVE); - caster->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_PASSIVE|UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_UNK_6); + caster->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15|UNIT_FLAG_IMMUNE_TO_NPC|UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_UNK_6); } } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 1f4fc8d3938..12d953a07b4 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -1372,7 +1372,7 @@ class npc_healthy_spore : public CreatureScript { npc_healthy_sporeAI(Creature* creature) : Scripted_NoMovementAI(creature) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); me->SetReactState(REACT_PASSIVE); DoCast(me, SPELL_HEALTHY_SPORE_VISUAL); DoCast(me, SPELL_POTENT_PHEROMONES); diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index 43a848c6b16..a11f88fc6af 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -117,7 +117,7 @@ public: bIsUndead = false; bEventInProgress = false; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetStandState(UNIT_STAND_STATE_STAND); events.Reset(); diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index 0a778f852a0..656b2931abb 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -268,7 +268,7 @@ public: void JustReachedHome() { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_IMMUNE_TO_PC); me->SetStandState(UNIT_STAND_STATE_STAND); DoCast(me, SPELL_FREEZE); } @@ -381,7 +381,7 @@ public: void JustReachedHome() { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC); me->SetStandState(UNIT_STAND_STATE_STAND); DoCast(me, SPELL_FREEZE); } @@ -496,7 +496,7 @@ public: void JustReachedHome() { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC); me->SetStandState(UNIT_STAND_STATE_STAND); DoCast(me, SPELL_FREEZE); } @@ -611,7 +611,7 @@ public: void JustReachedHome() { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC); me->SetStandState(UNIT_STAND_STATE_STAND); DoCast(me, SPELL_FREEZE); } @@ -732,7 +732,7 @@ public: void JustReachedHome() { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC); me->SetStandState(UNIT_STAND_STATE_STAND); DoCast(me, SPELL_FREEZE); } @@ -793,7 +793,7 @@ public: if (pNext) { pNext->RemoveAurasDueToSpell(SPELL_FREEZE); - pNext->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_OOC_NOT_ATTACKABLE); + pNext->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC); pNext->SetStandState(UNIT_STAND_STATE_STAND); pNext->SetInCombatWithZone(); pNext->Attack(pNext->SelectNearestTarget(100), true); diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp index 148ae2b6c4b..63f0cd39893 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp @@ -97,7 +97,7 @@ public: void AttackStart(Unit* who) { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; if (me->Attack(who, true)) @@ -109,13 +109,13 @@ public: if (Creature* pGuard1 = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_EREKEM_GUARD_1) : 0)) { - pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE); if (!pGuard1->getVictim() && pGuard1->AI()) pGuard1->AI()->AttackStart(who); } if (Creature* pGuard2 = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_EREKEM_GUARD_2) : 0)) { - pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE); if (!pGuard2->getVictim() && pGuard2->AI()) pGuard2->AI()->AttackStart(who); } @@ -290,7 +290,7 @@ public: void AttackStart(Unit* who) { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; if (me->Attack(who, true)) diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp index 5b36481eca8..a191d9349f2 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp @@ -140,7 +140,7 @@ public: void AttackStart(Unit* who) { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; if (me->Attack(who, true)) diff --git a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp index 21e4df37d8e..c5b2cb3c327 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp @@ -87,7 +87,7 @@ public: void AttackStart(Unit* who) { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; if (me->Attack(who, true)) diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp index 08bc24329ca..84b04579681 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp @@ -80,7 +80,7 @@ public: void AttackStart(Unit* who) { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; if (me->Attack(who, true)) diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp index 095d63f2dff..ac165ac39ef 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp @@ -123,7 +123,7 @@ public: void AttackStart(Unit* who) { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; if (me->Attack(who, true)) diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp index dc477855ff8..ff2009c2a17 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp @@ -91,7 +91,7 @@ public: void AttackStart(Unit* who) { - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return; if (me->Attack(who, true)) diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 3db63e5057b..5980c534595 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -249,7 +249,7 @@ public: if (uiCountErekemGuards < 2) { uiErekemGuard[uiCountErekemGuards++] = creature->GetGUID(); - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE); } break; case CREATURE_MORAGG: @@ -257,7 +257,7 @@ public: break; case CREATURE_CYANIGOSA: uiCyanigosa = creature->GetGUID(); - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE); break; case CREATURE_SINCLARI: uiSinclari = creature->GetGUID(); @@ -499,18 +499,18 @@ public: if (Creature* pGuard1 = instance->GetCreature(uiErekemGuard[0])) { if (bForceRespawn) - pGuard1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pGuard1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE); else - pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pGuard1->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE); pGuard1->GetMotionMaster()->MovePoint(0, BossStartMove21); } if (Creature* pGuard2 = instance->GetCreature(uiErekemGuard[1])) { if (bForceRespawn) - pGuard2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pGuard2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE); else - pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pGuard2->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE); pGuard2->GetMotionMaster()->MovePoint(0, BossStartMove22); } break; @@ -543,7 +543,7 @@ public: // generic boss state changes if (pBoss) { - pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pBoss->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE); pBoss->SetReactState(REACT_AGGRESSIVE); if (!bForceRespawn) @@ -554,7 +554,7 @@ public: pBoss->Respawn(); pBoss->RemoveLootMode(1); } - pBoss->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pBoss->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE); uiWaveCount = 0; } } @@ -750,7 +750,7 @@ public: case 3: pCyanigosa->RemoveAurasDueToSpell(CYANIGOSA_BLUE_AURA); pCyanigosa->CastSpell(pCyanigosa, CYANIGOSA_SPELL_TRANSFORM, 0); - pCyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + pCyanigosa->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE); pCyanigosa->SetReactState(REACT_AGGRESSIVE); uiCyanigosaEventTimer = 2*IN_MILLISECONDS; ++uiCyanigosaEventPhase; diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index 617ce9655a7..8b77cb250da 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -443,7 +443,7 @@ public: if (instance && !uiBoss) uiBoss = instance->GetData(DATA_WAVE_COUNT) == 6 ? instance->GetData(DATA_FIRST_BOSS) : instance->GetData(DATA_SECOND_BOSS); me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE|UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC|UNIT_FLAG_NON_ATTACKABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp index 9eb73463795..c0fad2374bc 100644 --- a/src/server/scripts/Northrend/grizzly_hills.cpp +++ b/src/server/scripts/Northrend/grizzly_hills.cpp @@ -370,7 +370,7 @@ public: if (me->FindNearestGameObject(OBJECT_HAUNCH, 2.0f)) { me->SetStandState(UNIT_STAND_STATE_DEAD); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); } m_uiPhase = 0; @@ -624,7 +624,7 @@ public: uiPlayerGUID = 0; uiTimer = 0; uiChopTimer = urand(10000, 12500); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); me->SetReactState(REACT_AGGRESSIVE); } @@ -683,7 +683,7 @@ public: { if (pCaster && pCaster->GetTypeId() == TYPEID_PLAYER && pSpell->Id == SPELL_SMOKE_BOMB) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC); me->SetReactState(REACT_PASSIVE); me->CombatStop(false); uiPlayerGUID = pCaster->GetGUID(); diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp index 2b73d57365a..0af82345dce 100644 --- a/src/server/scripts/Northrend/zuldrak.cpp +++ b/src/server/scripts/Northrend/zuldrak.cpp @@ -586,7 +586,7 @@ public: { npc_orinoko_tuskbreakerAI(Creature* creature) : ScriptedAI(creature) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetReactState(REACT_PASSIVE); } @@ -622,7 +622,7 @@ public: if (uiType != POINT_MOTION_TYPE) return; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetReactState(REACT_AGGRESSIVE); me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); uiBattleShoutTimer = 7000; @@ -734,7 +734,7 @@ public: void Reset() { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetReactState(REACT_PASSIVE); uiChargeTimer = 15000; uiUppercutTimer = 12000; @@ -747,7 +747,7 @@ public: { case 6: me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetReactState(REACT_AGGRESSIVE); break; } @@ -914,7 +914,7 @@ public: { npc_stinkbeardAI(Creature* creature) : npc_escortAI(creature) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetReactState(REACT_PASSIVE); Start(true, true, 0, NULL); SetDespawnAtEnd(false); @@ -940,7 +940,7 @@ public: switch (uiI) { case 7: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetReactState(REACT_AGGRESSIVE); me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); break; diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index c17b6d5baf3..58f0e10c950 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -1865,7 +1865,7 @@ void boss_illidan_stormrage::boss_illidan_stormrageAI::Reset() TransformCount = 0; me->SetDisplayId(21135); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index 3c06efefb08..0ed9d8e7833 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -136,7 +136,7 @@ public: DoCast(me, SPELL_SUBMERGE);//submerge anim me->SetVisible(false);//we start invis under water, submerged me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } void JustDied(Unit* /*Killer*/) @@ -205,7 +205,7 @@ public: { WaitTimer = 3000; CanStartEvent = true;//fresh fished from pool - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } else @@ -325,7 +325,7 @@ public: Submerged = false; me->InterruptNonMeleeSpells(false);//shouldn't be any me->RemoveAllAuras(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->RemoveFlag(UNIT_NPC_EMOTESTATE, EMOTE_STATE_SUBMERGED); DoCast(me, SPELL_EMERGE, true); Spawned = false; @@ -344,7 +344,7 @@ public: if (!Spawned) { - me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); //spawn adds for (uint8 i = 0; i < 9; ++i) { diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index 1f17e9e4802..c355079e0e8 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -252,7 +252,7 @@ class boss_magtheridon : public CreatureScript me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); me->AddUnitState(UNIT_STATE_STUNNED); DoCast(me, SPELL_SHADOW_CAGE_C, true); } diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp index 327ca289553..de86ec8672c 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp @@ -89,7 +89,7 @@ class boss_harbinger_skyriss : public CreatureScript void Reset() { if (!Intro) - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); IsImage33 = false; IsImage66 = false; @@ -184,7 +184,7 @@ class boss_harbinger_skyriss : public CreatureScript Intro_Timer = 3000; break; case 3: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); Intro = true; break; } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index d3e484d80ab..940e494f18f 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -223,13 +223,13 @@ public: void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); target->AddUnitState(UNIT_STATE_ROOT); } void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } void Register() diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp index 521e38a7061..165ef9f18b1 100644 --- a/src/server/scripts/World/item_scripts.cpp +++ b/src/server/scripts/World/item_scripts.cpp @@ -242,7 +242,7 @@ public: { summon->SetVisible(false); summon->SetReactState(REACT_PASSIVE); - summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } return false; } -- cgit v1.2.3 From 43a74f01012219bc2d0aadd28a2081e04794e3ba Mon Sep 17 00:00:00 2001 From: Souler Date: Sun, 5 Feb 2012 13:17:10 +0100 Subject: Scripts/Quests: "Mastery of Melee", "Mastery of Shield-Breaker" and "Master of Charge" --- sql/updates/world/2012_02_05_00_world_misc.sql | 126 ++++++++++++++++++++ src/server/game/Spells/SpellMgr.cpp | 1 + src/server/scripts/Northrend/icecrown.cpp | 157 +++++++++++++++++++++++++ src/server/scripts/Spells/spell_generic.cpp | 5 +- 4 files changed, 287 insertions(+), 2 deletions(-) create mode 100644 sql/updates/world/2012_02_05_00_world_misc.sql (limited to 'src/server/scripts/Northrend') diff --git a/sql/updates/world/2012_02_05_00_world_misc.sql b/sql/updates/world/2012_02_05_00_world_misc.sql new file mode 100644 index 00000000000..aaae3b1e0af --- /dev/null +++ b/sql/updates/world/2012_02_05_00_world_misc.sql @@ -0,0 +1,126 @@ +-- Argent Tournament Trainers part +SET @SPELL_ON_ARGENT_MOUNT := 63034; + +SET @NPC_JAERAN_LOCKWOOD := 33973; +SET @QUEST_MASTERY_OF_MELEE_A := 13828; +SET @QUEST_MASTERY_OF_MELEE_H := 13829; + +SET @GOSSIP_MENU_JERAN_MOUNTED := 10398; +SET @GOSSIP_MENU_JERAN_EXPLANATION := 10397; -- From Aokromes Sniffs + +SET @GOSSIP_TEXT_JERAN_MOUNTED := 14431; +SET @GOSSIP_TEXT_JERAN_EXPLANATION := 14434; +SET @SPELL_CREDIT_JERAN := 64113; + +SET @NPC_RUGAN_STEELBELLY := 33972; +SET @QUEST_MASTERY_OF_CHARGE_A := 13837; +SET @QUEST_MASTERY_OF_CHARGE_H := 13839; + +SET @GOSSIP_MENU_RUGAN_MOUNTED := 10400; +SET @GOSSIP_MENU_RUGAN_EXPLANATION := 10399; -- From Aokromes Sniffs + +SET @GOSSIP_TEXT_RUGAN_MOUNTED := 14436; +SET @GOSSIP_TEXT_RUGAN_EXPLANATION := 14437; +SET @SPELL_CREDIT_RUGAN := 64114; + +SET @NPC_VALIS_WINDCHASER := 33974; +SET @QUEST_MASTERY_OF_SH_BREAKER_A := 13835; +SET @QUEST_MASTERY_OF_SH_BREAKER_H := 13838; + +SET @GOSSIP_MENU_VALIS_MOUNTED := 10402; +SET @GOSSIP_MENU_VALIS_EXPLANATION := 10401; -- From Aokromes Sniffs + +SET @GOSSIP_TEXT_VALIS_MOUNTED := 14438; +SET @GOSSIP_TEXT_VALIS_EXPLANATION := 14439; +SET @SPELL_CREDIT_VALIS := 64115; + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry`IN(@NPC_JAERAN_LOCKWOOD,@NPC_RUGAN_STEELBELLY,@NPC_VALIS_WINDCHASER); +DELETE FROM `smart_scripts` WHERE (`entryorguid`IN(@NPC_JAERAN_LOCKWOOD,@NPC_RUGAN_STEELBELLY) AND `source_type`=0); +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@NPC_JAERAN_LOCKWOOD,0,0,0,64,0,100,0,0,0,0,0,98,@GOSSIP_MENU_JERAN_MOUNTED,@GOSSIP_TEXT_JERAN_MOUNTED,0,0,0,0,7,0,0,0,0,0,0,0,'Jeran Lockwood - Send different gossip when mounted (Requires conditions)'), +(@NPC_JAERAN_LOCKWOOD,0,1,3,62,0,100,0,@GOSSIP_MENU_JERAN_MOUNTED,0,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Jeran Lockwood - Send text when option clicked'), +(@NPC_JAERAN_LOCKWOOD,0,2,3,62,0,100,0,@GOSSIP_MENU_JERAN_EXPLANATION,0,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Jeran Lockwood - Send text when option clicked'), +(@NPC_JAERAN_LOCKWOOD,0,3,4,61,0,100,0,0,0,0,0,11,@SPELL_CREDIT_JERAN,0,0,0,0,0,7,0,0,0,0,0,0,0,'Jeran Lockwood - Give Credit'), +(@NPC_JAERAN_LOCKWOOD,0,4,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Jeran Lockwood - Close Gossip'), + +(@NPC_RUGAN_STEELBELLY,0,0,0,64,0,100,0,0,0,0,0,98,@GOSSIP_MENU_RUGAN_MOUNTED,@GOSSIP_TEXT_RUGAN_MOUNTED,0,0,0,0,7,0,0,0,0,0,0,0,'Rugan Steelbelly - Send different gossip when mounted (Requires conditions)'), +(@NPC_RUGAN_STEELBELLY,0,1,3,62,0,100,0,@GOSSIP_MENU_RUGAN_MOUNTED,0,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Rugan Steelbelly - Send text when option clicked'), +(@NPC_RUGAN_STEELBELLY,0,2,3,62,0,100,0,@GOSSIP_MENU_RUGAN_EXPLANATION,0,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Rugan Steelbelly - Send text when option clicked'), +(@NPC_RUGAN_STEELBELLY,0,3,4,61,0,100,0,0,0,0,0,11,@SPELL_CREDIT_RUGAN,0,0,0,0,0,7,0,0,0,0,0,0,0,'Rugan Steelbelly - Give Credit'), +(@NPC_RUGAN_STEELBELLY,0,4,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Rugan Steelbelly - Close Gossip'), + +(@NPC_VALIS_WINDCHASER,0,0,0,64,0,100,0,0,0,0,0,98,@GOSSIP_MENU_VALIS_MOUNTED,@GOSSIP_TEXT_VALIS_MOUNTED,0,0,0,0,7,0,0,0,0,0,0,0,'Valis Windchaser - Send different gossip when mounted (Requires conditions)'), +(@NPC_VALIS_WINDCHASER,0,1,3,62,0,100,0,@GOSSIP_MENU_VALIS_MOUNTED,0,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Valis Windchaser - Send text when option clicked'), +(@NPC_VALIS_WINDCHASER,0,2,3,62,0,100,0,@GOSSIP_TEXT_VALIS_EXPLANATION,0,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Valis Windchaser - Send text when option clicked'), +(@NPC_VALIS_WINDCHASER,0,3,4,61,0,100,0,0,0,0,0,11,@SPELL_CREDIT_VALIS,0,0,0,0,0,7,0,0,0,0,0,0,0,'Valis Windchaser - Give Credit'), +(@NPC_VALIS_WINDCHASER,0,4,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Valis Windchaser - Close Gossip'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry`IN(@NPC_JAERAN_LOCKWOOD,@NPC_RUGAN_STEELBELLY,@NPC_VALIS_WINDCHASER); +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`IN(@GOSSIP_MENU_JERAN_MOUNTED,@GOSSIP_MENU_RUGAN_MOUNTED,@GOSSIP_MENU_VALIS_MOUNTED); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(22,1,@NPC_JAERAN_LOCKWOOD,0,0,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'','SAI - Jeran Lockwood show different menu if player mounted'), +(15,@GOSSIP_MENU_JERAN_MOUNTED,0,0,0,9,@QUEST_MASTERY_OF_MELEE_A,0,0,0,'',"Jeran Lockwood - Show gossip if player has quest"), +(15,@GOSSIP_MENU_JERAN_MOUNTED,0,0,0,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'',"Jeran Lockwood - Show gossip if player has aura"), +(15,@GOSSIP_MENU_JERAN_MOUNTED,0,0,1,9,@QUEST_MASTERY_OF_MELEE_H,0,0,0,'',"Jeran Lockwood - Show gossip if player has quest"), +(15,@GOSSIP_MENU_JERAN_MOUNTED,0,0,1,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'',"Jeran Lockwood - Show gossip if player has aura"), +(15,@GOSSIP_MENU_JERAN_MOUNTED,1,0,0,9,@QUEST_MASTERY_OF_MELEE_A,0,0,0,'',"Jeran Lockwood - Show gossip if player has quest"), +(15,@GOSSIP_MENU_JERAN_MOUNTED,1,0,0,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'',"Jeran Lockwood - Show gossip if player has aura"), +(15,@GOSSIP_MENU_JERAN_MOUNTED,1,0,1,9,@QUEST_MASTERY_OF_MELEE_H,0,0,0,'',"Jeran Lockwood - Show gossip if player has quest"), +(15,@GOSSIP_MENU_JERAN_MOUNTED,1,0,1,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'',"Jeran Lockwood - Show gossip if player has aura"), + +(22,1,@NPC_RUGAN_STEELBELLY,0,0,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'','SAI - Rugan Steelbelly show different menu if player mounted'), +(15,@GOSSIP_MENU_RUGAN_MOUNTED,0,0,0,9,@QUEST_MASTERY_OF_CHARGE_A,0,0,0,'',"Rugan Steelbelly - Show gossip if player has quest"), +(15,@GOSSIP_MENU_RUGAN_MOUNTED,0,0,0,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'',"Rugan Steelbelly - Show gossip if player has aura"), +(15,@GOSSIP_MENU_RUGAN_MOUNTED,0,0,1,9,@QUEST_MASTERY_OF_CHARGE_H,0,0,0,'',"Rugan Steelbelly - Show gossip if player has quest"), +(15,@GOSSIP_MENU_RUGAN_MOUNTED,0,0,1,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'',"Rugan Steelbelly - Show gossip if player has aura"), +(15,@GOSSIP_MENU_RUGAN_MOUNTED,1,0,0,9,@QUEST_MASTERY_OF_CHARGE_A,0,0,0,'',"Rugan Steelbelly - Show gossip if player has quest"), +(15,@GOSSIP_MENU_RUGAN_MOUNTED,1,0,0,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'',"Rugan Steelbelly - Show gossip if player has aura"), +(15,@GOSSIP_MENU_RUGAN_MOUNTED,1,0,1,9,@QUEST_MASTERY_OF_CHARGE_H,0,0,0,'',"Rugan Steelbelly - Show gossip if player has quest"), +(15,@GOSSIP_MENU_RUGAN_MOUNTED,1,0,1,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'',"Rugan Steelbelly - Show gossip if player has aura"), + +(22,1,@NPC_VALIS_WINDCHASER,0,0,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'','SAI - Valis Windchaser show different menu if player mounted'), +(15,@GOSSIP_MENU_VALIS_MOUNTED,0,0,0,9,@QUEST_MASTERY_OF_SH_BREAKER_A,0,0,0,'',"Valis Windchaser - Show gossip if player has quest"), +(15,@GOSSIP_MENU_VALIS_MOUNTED,0,0,0,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'',"Valis Windchaser - Show gossip if player has aura"), +(15,@GOSSIP_MENU_VALIS_MOUNTED,0,0,1,9,@QUEST_MASTERY_OF_SH_BREAKER_H,0,0,0,'',"Valis Windchaser - Show gossip if player has quest"), +(15,@GOSSIP_MENU_VALIS_MOUNTED,0,0,1,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'',"Valis Windchaser - Show gossip if player has aura"), +(15,@GOSSIP_MENU_VALIS_MOUNTED,1,0,0,9,@QUEST_MASTERY_OF_SH_BREAKER_A,0,0,0,'',"Valis Windchaser - Show gossip if player has quest"), +(15,@GOSSIP_MENU_VALIS_MOUNTED,1,0,0,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'',"Valis Windchaser - Show gossip if player has aura"), +(15,@GOSSIP_MENU_VALIS_MOUNTED,1,0,1,9,@QUEST_MASTERY_OF_SH_BREAKER_H,0,0,0,'',"Valis Windchaser - Show gossip if player has quest"), +(15,@GOSSIP_MENU_VALIS_MOUNTED,1,0,1,1,@SPELL_ON_ARGENT_MOUNT,0,0,0,'',"Valis Windchaser - Show gossip if player has aura"); + +DELETE FROM `gossip_menu` WHERE `entry` IN (@GOSSIP_MENU_JERAN_EXPLANATION,@GOSSIP_MENU_RUGAN_EXPLANATION,@GOSSIP_MENU_VALIS_EXPLANATION); +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES +(@GOSSIP_MENU_JERAN_EXPLANATION,@GOSSIP_TEXT_JERAN_EXPLANATION), +(@GOSSIP_MENU_RUGAN_EXPLANATION,@GOSSIP_TEXT_RUGAN_EXPLANATION), +(@GOSSIP_MENU_VALIS_EXPLANATION,@GOSSIP_TEXT_VALIS_EXPLANATION); + +DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (@GOSSIP_MENU_JERAN_MOUNTED,@GOSSIP_MENU_JERAN_EXPLANATION,@GOSSIP_MENU_RUGAN_MOUNTED,@GOSSIP_MENU_RUGAN_EXPLANATION,@GOSSIP_MENU_VALIS_MOUNTED,@GOSSIP_MENU_VALIS_EXPLANATION); +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES +(@GOSSIP_MENU_JERAN_MOUNTED,0,0,'Show me how to train with a Melee Target.',1,1,0,0,0,0,''), +(@GOSSIP_MENU_JERAN_MOUNTED,1,0,'Tell me more about Defend and Thrust!',1,1,@GOSSIP_MENU_JERAN_EXPLANATION,0,0,0,''), +(@GOSSIP_MENU_JERAN_EXPLANATION,0,0,'Show me how to train with a Melee Target.',1,1,0,0,0,0,''), + +(@GOSSIP_MENU_RUGAN_MOUNTED,0,0,'Show me how to train with a Charge Target.',1,1,0,0,0,0,''), +(@GOSSIP_MENU_RUGAN_MOUNTED,1,0,'Tell me more about the Charge!',1,1,@GOSSIP_MENU_RUGAN_EXPLANATION,0,0,0,''), +(@GOSSIP_MENU_RUGAN_EXPLANATION,0,0,'Show me how to train with a Charge Target.',1,1,0,0,0,0,''), + +(@GOSSIP_MENU_VALIS_MOUNTED,0,0,'Show me how to train with a Ranged Target.',1,1,0,0,0,0,''), +(@GOSSIP_MENU_VALIS_MOUNTED,1,0,'Tell me more about the Shield-Breaker!',1,1,@GOSSIP_MENU_VALIS_EXPLANATION,0,0,0,''), +(@GOSSIP_MENU_VALIS_EXPLANATION,0,0,'Show me how to train with a Ranged Target.',1,1,0,0,0,0,''); + +DELETE FROM `creature_text` WHERE `entry` IN (@NPC_JAERAN_LOCKWOOD,@NPC_RUGAN_STEELBELLY,@NPC_VALIS_WINDCHASER); +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@NPC_JAERAN_LOCKWOOD,0,0,'Put up defend$B|TInterface\\Icons\\ability_warrior_shieldmastery.blp:32|t$BThen use Thrust on a Melee Target$B|TInterface\\Icons\\inv_sword_65.blp:32|t',42,0,0,0,0,0,'Argent Tournament - Melee Tutorial'), +(@NPC_RUGAN_STEELBELLY,0,0,'Use Shield-Breaker on a Charge Target$B|TInterface\\Icons\\ability_warrior_shieldbreak.blp:32|t$BFollow up with Charge while the target is vulnerable$B|TInterface\\Icons\\ability_mount_charger.blp:32|t',42,0,0,0,0,0,'Argent Tournament - Charge Tutorial'), +(@NPC_VALIS_WINDCHASER,0,0,'Use Shield-Breaker on a Ranged Target$B|TInterface\\Icons\\ability_warrior_shieldbreak.blp:32|t$BThen use Shield-Breaker while the target is defenseless$B|TInterface\\Icons\\ability_warrior_shieldbreak.blp:32|t',42,0,0,0,0,0,'Argent Tournament - Ranged Tutorial'); + +-- Training Dummies Part +UPDATE `creature_template` SET `ScriptName` = 'npc_tournament_training_dummy' WHERE `entry` IN (33272,33229,33243); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=62709; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,62709,0,0,18,1,33845,0,0, '','Counterattack! (Argent Tournament) - Target near aspirant mounts'), +(13,0,62709,0,0,18,1,33323,0,0, '','Counterattack! (Argent Tournament) - Target near aspirant mounts'); + +DELETE FROM `spell_script_names` WHERE `spell_id`=62709; +INSERT INTO `spell_script_names` VALUES (62709, 'spell_gen_tournament_counterattack'); \ No newline at end of file diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 171382ba4f7..99961664aa8 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2893,6 +2893,7 @@ void SpellMgr::LoadSpellCustomAttr() case 64588: // Thrust (Argent Tournament) case 66479: // Thrust (Argent Tournament) case 68505: // Thrust (Argent Tournament) + case 62709: // Counterattack! (Argent Tournament) case 62626: // Break-Shield (Argent Tournament, Player) case 64590: // Break-Shield (Argent Tournament, Player) case 64342: // Break-Shield (Argent Tournament, NPC) diff --git a/src/server/scripts/Northrend/icecrown.cpp b/src/server/scripts/Northrend/icecrown.cpp index 91522503d65..8da992af8fb 100644 --- a/src/server/scripts/Northrend/icecrown.cpp +++ b/src/server/scripts/Northrend/icecrown.cpp @@ -335,6 +335,162 @@ public: } }; +/*###### +* npc_tournament_training_dummy +######*/ +enum TournamentDummy +{ + NPC_CHARGE_TARGET = 33272, + NPC_MELEE_TARGET = 33229, + NPC_RANGED_TARGET = 33243, + + SPELL_CHARGE_CREDIT = 62658, + SPELL_MELEE_CREDIT = 62672, + SPELL_RANGED_CREDIT = 62673, + + SPELL_PLAYER_THRUST = 62544, + SPELL_PLAYER_BREAK_SHIELD = 62626, + SPELL_PLAYER_CHARGE = 62874, + + SPELL_RANGED_DEFEND = 62719, + SPELL_CHARGE_DEFEND = 64100, + SPELL_VULNERABLE = 62665, + + SPELL_COUNTERATTACK = 62709, + + EVENT_DUMMY_RECAST_DEFEND = 1, + EVENT_DUMMY_RESET = 2, +}; + +class npc_tournament_training_dummy : public CreatureScript +{ + public: + npc_tournament_training_dummy(): CreatureScript("npc_tournament_training_dummy"){} + + struct npc_tournament_training_dummyAI : Scripted_NoMovementAI + { + npc_tournament_training_dummyAI(Creature* creature) : Scripted_NoMovementAI(creature) {} + + EventMap events; + bool isVulnerable; + + void Reset() + { + me->SetControlled(true, UNIT_STATE_STUNNED); + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); + isVulnerable = false; + + // Cast Defend spells to max stack size + switch (me->GetEntry()) + { + case NPC_CHARGE_TARGET: + DoCast(SPELL_CHARGE_DEFEND); + break; + case NPC_RANGED_TARGET: + me->CastCustomSpell(SPELL_RANGED_DEFEND, SPELLVALUE_AURA_STACK, 3, me); + break; + } + + events.Reset(); + events.ScheduleEvent(EVENT_DUMMY_RECAST_DEFEND, 5000); + } + + void EnterEvadeMode() + { + if (!_EnterEvadeMode()) + return; + + Reset(); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) + { + damage = 0; + events.RescheduleEvent(EVENT_DUMMY_RESET, 10000); + } + + void SpellHit(Unit* caster, SpellInfo const* spell) + { + switch (me->GetEntry()) + { + case NPC_CHARGE_TARGET: + if (spell->Id == SPELL_PLAYER_CHARGE) + if (isVulnerable) + DoCast(caster, SPELL_CHARGE_CREDIT, true); + break; + case NPC_MELEE_TARGET: + if (spell->Id == SPELL_PLAYER_THRUST) + { + DoCast(caster, SPELL_MELEE_CREDIT, true); + + if (Unit* target = caster->GetVehicleBase()) + DoCast(target, SPELL_COUNTERATTACK, true); + } + break; + case NPC_RANGED_TARGET: + if (spell->Id == SPELL_PLAYER_BREAK_SHIELD) + if (isVulnerable) + DoCast(caster, SPELL_RANGED_CREDIT, true); + break; + } + + if (spell->Id == SPELL_PLAYER_BREAK_SHIELD) + if (!me->HasAura(SPELL_CHARGE_DEFEND) && !me->HasAura(SPELL_RANGED_DEFEND)) + isVulnerable = true; + } + + void UpdateAI(uint32 const diff) + { + events.Update(diff); + + switch (events.ExecuteEvent()) + { + case EVENT_DUMMY_RECAST_DEFEND: + switch (me->GetEntry()) + { + case NPC_CHARGE_TARGET: + { + if (!me->HasAura(SPELL_CHARGE_DEFEND)) + DoCast(SPELL_CHARGE_DEFEND); + break; + } + case NPC_RANGED_TARGET: + { + Aura* defend = me->GetAura(SPELL_RANGED_DEFEND); + if (!defend || defend->GetStackAmount() < 3 || defend->GetDuration() <= 8000) + DoCast(SPELL_RANGED_DEFEND); + break; + } + } + isVulnerable = false; + events.ScheduleEvent(EVENT_DUMMY_RECAST_DEFEND, 5000); + break; + case EVENT_DUMMY_RESET: + if (UpdateVictim()) + { + EnterEvadeMode(); + events.ScheduleEvent(EVENT_DUMMY_RESET, 10000); + } + break; + } + + if (!UpdateVictim()) + return; + + if (!me->HasUnitState(UNIT_STATE_STUNNED)) + me->SetControlled(true, UNIT_STATE_STUNNED); + } + + void MoveInLineOfSight(Unit* /*who*/){} + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_tournament_training_dummyAI(creature); + } + +}; + void AddSC_icecrown() { new npc_arete; @@ -342,4 +498,5 @@ void AddSC_icecrown() new npc_argent_valiant; new npc_guardian_pavilion; new npc_vereth_the_cunning; + new npc_tournament_training_dummy; } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 3d552901295..afba35ba2b5 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1652,7 +1652,7 @@ enum BreakShieldSpells class spell_gen_break_shield: public SpellScriptLoader { public: - spell_gen_break_shield() : SpellScriptLoader("spell_gen_break_shield") { } + spell_gen_break_shield(const char* name) : SpellScriptLoader(name) {} class spell_gen_break_shield_SpellScript : public SpellScript { @@ -2390,7 +2390,8 @@ void AddSC_generic_spell_scripts() new spell_gen_dalaran_disguise("spell_gen_sunreaver_disguise"); new spell_gen_dalaran_disguise("spell_gen_silver_covenant_disguise"); new spell_gen_elune_candle(); - new spell_gen_break_shield(); + new spell_gen_break_shield("spell_gen_break_shield"); + new spell_gen_break_shield("spell_gen_tournament_counterattack"); new spell_gen_mounted_charge(); new spell_gen_defend(); new spell_gen_tournament_duel(); -- cgit v1.2.3 From 7a117dd429667a9ccf5a02d264e6d8e07a97cb8b Mon Sep 17 00:00:00 2001 From: Matthew Goff Date: Mon, 6 Feb 2012 01:22:45 +0000 Subject: Core/Misc: - Replace emote magic number by enum - Added all missing defines from AnimationData.dbc. Minor corrections to existing ones. Standardized some naming and updated cpp files as needed. - Correct a spell used in AQ Closes #3787 Closes #5095 --- sql/updates/world/2011_02_05_04_world_misc.sql | 11 - .../world/2011_02_05_04_world_quest_template.sql | 1 - sql/updates/world/2012_02_05_04_world_misc.sql | 11 + .../world/2012_02_05_04_world_quest_template.sql | 1 + src/server/game/Entities/Unit/Unit.cpp | 4 +- src/server/game/Miscellaneous/SharedDefines.h | 1097 ++++++++++++-------- .../BlackrockDepths/blackrock_depths.cpp | 4 +- .../ScarletEnclave/the_scarlet_enclave.cpp | 2 +- src/server/scripts/EasternKingdoms/westfall.cpp | 4 +- .../BattleForMountHyjal/hyjal_trash.cpp | 2 +- .../Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp | 2 +- src/server/scripts/Kalimdor/durotar.cpp | 2 +- src/server/scripts/Kalimdor/mulgore.cpp | 2 +- src/server/scripts/Kalimdor/the_barrens.cpp | 2 +- .../TrialOfTheCrusader/trial_of_the_crusader.cpp | 4 +- .../IcecrownCitadel/boss_the_lich_king.cpp | 8 +- .../Northrend/IcecrownCitadel/icecrown_citadel.cpp | 2 +- .../scripts/Northrend/Naxxramas/boss_gothik.cpp | 2 +- .../Northrend/Ulduar/Ulduar/boss_razorscale.cpp | 2 +- src/server/scripts/Northrend/grizzly_hills.cpp | 2 +- src/server/scripts/Outland/shadowmoon_valley.cpp | 2 +- 21 files changed, 727 insertions(+), 440 deletions(-) delete mode 100644 sql/updates/world/2011_02_05_04_world_misc.sql delete mode 100644 sql/updates/world/2011_02_05_04_world_quest_template.sql create mode 100644 sql/updates/world/2012_02_05_04_world_misc.sql create mode 100644 sql/updates/world/2012_02_05_04_world_quest_template.sql (limited to 'src/server/scripts/Northrend') diff --git a/sql/updates/world/2011_02_05_04_world_misc.sql b/sql/updates/world/2011_02_05_04_world_misc.sql deleted file mode 100644 index 0d72b08167e..00000000000 --- a/sql/updates/world/2011_02_05_04_world_misc.sql +++ /dev/null @@ -1,11 +0,0 @@ -DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=56278; - -DELETE FROM `db_script_string` WHERE `entry`=2000000077; -INSERT INTO `db_script_string` (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`)VALUES -(2000000077,'%s gestures to the pitcher of water sitting on the edge of the well.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); - -SET @GOSSIP := 4535; -SET @OLD := 663; -SET @NEW := 563; -UPDATE `conditions` SET `SourceEntry`=@NEW WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=@GOSSIP AND `SourceEntry`=@OLD; -UPDATE `gossip_menu` SET `text_id`=@NEW WHERE `entry`=@GOSSIP AND `text_id`=@OLD; diff --git a/sql/updates/world/2011_02_05_04_world_quest_template.sql b/sql/updates/world/2011_02_05_04_world_quest_template.sql deleted file mode 100644 index 093ca8aa8bf..00000000000 --- a/sql/updates/world/2011_02_05_04_world_quest_template.sql +++ /dev/null @@ -1 +0,0 @@ -UPDATE `quest_template` SET `OfferRewardText`= 'Alright, $n. You want to earn your keep with the Horde? Well there''s plenty to do here, so listen close and do what you''re told.$b$b$gI see that look in your eyes, do not think I will tolerate any insolence. Thrall himself has declared the Hordes females to be on equal footing with you men. Disrespect me in the slightest, and you will know true pain.:I''m happy to have met you. Thrall will be glad to know that more females like you and I are taking the initiative to push forward in the Barrens.;' WHERE `Id`=842; diff --git a/sql/updates/world/2012_02_05_04_world_misc.sql b/sql/updates/world/2012_02_05_04_world_misc.sql new file mode 100644 index 00000000000..0d72b08167e --- /dev/null +++ b/sql/updates/world/2012_02_05_04_world_misc.sql @@ -0,0 +1,11 @@ +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=56278; + +DELETE FROM `db_script_string` WHERE `entry`=2000000077; +INSERT INTO `db_script_string` (`entry`,`content_default`,`content_loc1`,`content_loc2`,`content_loc3`,`content_loc4`,`content_loc5`,`content_loc6`,`content_loc7`,`content_loc8`)VALUES +(2000000077,'%s gestures to the pitcher of water sitting on the edge of the well.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); + +SET @GOSSIP := 4535; +SET @OLD := 663; +SET @NEW := 563; +UPDATE `conditions` SET `SourceEntry`=@NEW WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=@GOSSIP AND `SourceEntry`=@OLD; +UPDATE `gossip_menu` SET `text_id`=@NEW WHERE `entry`=@GOSSIP AND `text_id`=@OLD; diff --git a/sql/updates/world/2012_02_05_04_world_quest_template.sql b/sql/updates/world/2012_02_05_04_world_quest_template.sql new file mode 100644 index 00000000000..093ca8aa8bf --- /dev/null +++ b/sql/updates/world/2012_02_05_04_world_quest_template.sql @@ -0,0 +1 @@ +UPDATE `quest_template` SET `OfferRewardText`= 'Alright, $n. You want to earn your keep with the Horde? Well there''s plenty to do here, so listen close and do what you''re told.$b$b$gI see that look in your eyes, do not think I will tolerate any insolence. Thrall himself has declared the Hordes females to be on equal footing with you men. Disrespect me in the slightest, and you will know true pain.:I''m happy to have met you. Thrall will be glad to know that more females like you and I are taking the initiative to push forward in the Barrens.;' WHERE `Id`=842; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 96e8978ed33..db36a148a57 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1286,9 +1286,9 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) // Hmmmm dont like this emotes client must by self do all animations if (damageInfo->HitInfo & HITINFO_CRITICALHIT) - victim->HandleEmoteCommand(EMOTE_ONESHOT_WOUNDCRITICAL); + victim->HandleEmoteCommand(EMOTE_ONESHOT_WOUND_CRITICAL); if (damageInfo->blocked_amount && damageInfo->TargetState != VICTIMSTATE_BLOCKS) - victim->HandleEmoteCommand(EMOTE_ONESHOT_PARRYSHIELD); + victim->HandleEmoteCommand(EMOTE_ONESHOT_PARRY_SHIELD); if (damageInfo->TargetState == VICTIMSTATE_PARRY) { diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 78c49092740..da4f022a4b0 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -95,6 +95,7 @@ enum Races // Class value is index in ChrClasses.dbc enum Classes { + CLASS_NONE = 0, CLASS_WARRIOR = 1, CLASS_PALADIN = 2, CLASS_HUNTER = 3, @@ -1502,6 +1503,7 @@ enum GameObjectDestructibleState GO_DESTRUCTIBLE_REBUILDING = 3, }; +// EmotesText.dbc enum TextEmotes { TEXT_EMOTE_AGREE = 1, @@ -1665,7 +1667,7 @@ enum TextEmotes TEXT_EMOTE_ATTACKMYTARGET = 307, TEXT_EMOTE_OOM = 323, TEXT_EMOTE_FOLLOW = 324, - TEXT_EMOTE_HELP = 325, + TEXT_EMOTE_WAIT = 325, TEXT_EMOTE_HEALME = 326, TEXT_EMOTE_OPENFIRE = 327, TEXT_EMOTE_FLIRT = 328, @@ -1674,7 +1676,7 @@ enum TextEmotes TEXT_EMOTE_WINK = 363, TEXT_EMOTE_PAT = 364, TEXT_EMOTE_SERIOUS = 365, - TEXT_EMOTE_MOUNTSPECIAL = 366, + TEXT_EMOTE_MOUNT_SPECIAL = 366, TEXT_EMOTE_GOODLUCK = 367, TEXT_EMOTE_BLAME = 368, TEXT_EMOTE_BLANK = 369, @@ -1687,6 +1689,7 @@ enum TextEmotes TEXT_EMOTE_ENEMY = 376, TEXT_EMOTE_EYEBROW = 377, TEXT_EMOTE_TOAST = 378, + TEXT_EMOTE_FAIL = 379, TEXT_EMOTE_HIGHFIVE = 380, TEXT_EMOTE_ABSENT = 381, TEXT_EMOTE_ARM = 382, @@ -1741,6 +1744,7 @@ enum TextEmotes TEXT_EMOTE_SNEEZE = 436, TEXT_EMOTE_SNORT = 437, TEXT_EMOTE_SQUEAL = 438, + TEXT_EMOTE_STOPATTACK = 439, TEXT_EMOTE_SUSPICIOUS = 440, TEXT_EMOTE_THINK = 441, TEXT_EMOTE_TRUCE = 442, @@ -1756,412 +1760,695 @@ enum TextEmotes TEXT_EMOTE_YW = 453, }; +// Emotes.dbc enum Emote { - EMOTE_ONESHOT_NONE = 0, - EMOTE_ONESHOT_TALK = 1, - EMOTE_ONESHOT_BOW = 2, - EMOTE_ONESHOT_WAVE = 3, - EMOTE_ONESHOT_CHEER = 4, - EMOTE_ONESHOT_EXCLAMATION = 5, - EMOTE_ONESHOT_QUESTION = 6, - EMOTE_ONESHOT_EAT = 7, - EMOTE_STATE_DANCE = 10, - EMOTE_ONESHOT_LAUGH = 11, - EMOTE_STATE_SLEEP = 12, - EMOTE_STATE_SIT = 13, - EMOTE_ONESHOT_RUDE = 14, - EMOTE_ONESHOT_ROAR = 15, - EMOTE_ONESHOT_KNEEL = 16, - EMOTE_ONESHOT_KISS = 17, - EMOTE_ONESHOT_CRY = 18, - EMOTE_ONESHOT_CHICKEN = 19, - EMOTE_ONESHOT_BEG = 20, - EMOTE_ONESHOT_APPLAUD = 21, - EMOTE_ONESHOT_SHOUT = 22, - EMOTE_ONESHOT_FLEX = 23, - EMOTE_ONESHOT_SHY = 24, - EMOTE_ONESHOT_POINT = 25, - EMOTE_STATE_STAND = 26, - EMOTE_STATE_READYUNARMED = 27, - EMOTE_STATE_WORK_SHEATHED = 28, - EMOTE_STATE_POINT = 29, - EMOTE_STATE_NONE = 30, - EMOTE_ONESHOT_WOUND = 33, - EMOTE_ONESHOT_WOUNDCRITICAL = 34, - EMOTE_ONESHOT_ATTACKUNARMED = 35, - EMOTE_ONESHOT_ATTACK1H = 36, - EMOTE_ONESHOT_ATTACK2HTIGHT = 37, - EMOTE_ONESHOT_ATTACK2HLOOSE = 38, - EMOTE_ONESHOT_PARRYUNARMED = 39, - EMOTE_ONESHOT_PARRYSHIELD = 43, - EMOTE_ONESHOT_READYUNARMED = 44, - EMOTE_ONESHOT_READY1H = 45, - EMOTE_ONESHOT_READYBOW = 48, - EMOTE_ONESHOT_SPELLPRECAST = 50, - EMOTE_ONESHOT_SPELLCAST = 51, - EMOTE_ONESHOT_BATTLEROAR = 53, - EMOTE_ONESHOT_SPECIALATTACK1H = 54, - EMOTE_ONESHOT_KICK = 60, - EMOTE_ONESHOT_ATTACKTHROWN = 61, - EMOTE_STATE_STUN = 64, - EMOTE_STATE_DEAD = 65, - EMOTE_ONESHOT_SALUTE = 66, - EMOTE_STATE_KNEEL = 68, - EMOTE_STATE_USESTANDING = 69, - EMOTE_ONESHOT_WAVE_NOSHEATHE = 70, - EMOTE_ONESHOT_CHEER_NOSHEATHE = 71, - EMOTE_ONESHOT_EAT_NOSHEATHE = 92, - EMOTE_STATE_STUN_NOSHEATHE = 93, - EMOTE_ONESHOT_DANCE = 94, - EMOTE_ONESHOT_SALUTE_NOSHEATH = 113, - EMOTE_STATE_USESTANDING_NOSHEATHE = 133, - EMOTE_ONESHOT_LAUGH_NOSHEATHE = 153, - EMOTE_STATE_WORK = 173, - EMOTE_STATE_SPELLPRECAST = 193, - EMOTE_ONESHOT_READYRIFLE = 213, - EMOTE_STATE_READYRIFLE = 214, - EMOTE_STATE_WORK_MINING = 233, - EMOTE_STATE_WORK_CHOPWOOD = 234, - EMOTE_STATE_APPLAUD = 253, - EMOTE_ONESHOT_LIFTOFF = 254, - EMOTE_ONESHOT_YES = 273, - EMOTE_ONESHOT_NO = 274, - EMOTE_ONESHOT_TRAIN = 275, - EMOTE_ONESHOT_LAND = 293, - EMOTE_STATE_AT_EASE = 313, - EMOTE_STATE_READY1H = 333, - EMOTE_STATE_SPELLKNEELSTART = 353, - EMOTE_STATE_SUBMERGED = 373, - EMOTE_ONESHOT_SUBMERGE = 374, - EMOTE_STATE_READY2H = 375, - EMOTE_STATE_READYBOW = 376, - EMOTE_ONESHOT_MOUNTSPECIAL = 377, - EMOTE_STATE_TALK = 378, - EMOTE_STATE_FISHING = 379, - EMOTE_ONESHOT_FISHING = 380, - EMOTE_ONESHOT_LOOT = 381, - EMOTE_STATE_WHIRLWIND = 382, - EMOTE_STATE_DROWNED = 383, - EMOTE_STATE_HOLD_BOW = 384, - EMOTE_STATE_HOLD_RIFLE = 385, - EMOTE_STATE_HOLD_THROWN = 386, - EMOTE_ONESHOT_DROWN = 387, - EMOTE_ONESHOT_STOMP = 388, - EMOTE_ONESHOT_ATTACKOFF = 389, - EMOTE_ONESHOT_ATTACKOFFPIERCE = 390, - EMOTE_STATE_ROAR = 391, - EMOTE_STATE_LAUGH = 392, - EMOTE_ONESHOT_CREATURE_SPECIAL = 393, - EMOTE_ONESHOT_JUMPLANDRUN = 394, - EMOTE_ONESHOT_JUMPEND = 395, - EMOTE_ONESHOT_TALK_NOSHEATHE = 396, - EMOTE_ONESHOT_POINT_NOSHEATHE = 397, - EMOTE_STATE_CANNIBALIZE = 398, - EMOTE_ONESHOT_JUMPSTART = 399, - EMOTE_STATE_DANCESPECIAL = 400, - EMOTE_ONESHOT_DANCESPECIAL = 401, - EMOTE_ONESHOT_CUSTOMSPELL01 = 402, - EMOTE_ONESHOT_CUSTOMSPELL02 = 403, - EMOTE_ONESHOT_CUSTOMSPELL03 = 404, - EMOTE_ONESHOT_CUSTOMSPELL04 = 405, - EMOTE_ONESHOT_CUSTOMSPELL05 = 406, - EMOTE_ONESHOT_CUSTOMSPELL06 = 407, - EMOTE_ONESHOT_CUSTOMSPELL07 = 408, - EMOTE_ONESHOT_CUSTOMSPELL08 = 409, - EMOTE_ONESHOT_CUSTOMSPELL09 = 410, - EMOTE_ONESHOT_CUSTOMSPELL10 = 411, - EMOTE_STATE_EXCLAIM = 412, - EMOTE_STATE_DANCE_CUSTOM = 413, - EMOTE_STATE_SIT_CHAIR_MED = 415, - EMOTE_STATE_CUSTOM_SPELL_01 = 416, - EMOTE_STATE_CUSTOM_SPELL_02 = 417, - EMOTE_STATE_EAT = 418, - EMOTE_STATE_CUSTOM_SPELL_04 = 419, - EMOTE_STATE_CUSTOM_SPELL_03 = 420, - EMOTE_STATE_CUSTOM_SPELL_05 = 421, - EMOTE_STATE_SPELLEFFECT_HOLD = 422, - EMOTE_STATE_EAT_NO_SHEATHE = 423, - EMOTE_STATE_MOUNT = 424, - EMOTE_STATE_READY2HL = 425, - EMOTE_STATE_SIT_CHAIR_HIGH = 426, - EMOTE_STATE_FALL = 427, - EMOTE_STATE_LOOT = 428, - EMOTE_STATE_SUBMERGED_NEW = 429, - EMOTE_ONESHOT_COWER = 430, - EMOTE_STATE_COWER = 431, - EMOTE_ONESHOT_USESTANDING = 432, - EMOTE_STATE_STEALTH_STAND = 433, - EMOTE_ONESHOT_OMNICAST_GHOUL = 434, - EMOTE_ONESHOT_ATTACKBOW = 435, - EMOTE_ONESHOT_ATTACKRIFLE = 436, - EMOTE_STATE_SWIM_IDLE = 437, - EMOTE_STATE_ATTACK_UNARMED = 438, - EMOTE_ONESHOT_SPELLCAST_W_SOUND = 439, - EMOTE_ONESHOT_DODGE = 440, - EMOTE_ONESHOT_PARRY1H = 441, - EMOTE_ONESHOT_PARRY2H = 442, - EMOTE_ONESHOT_PARRY2HL = 443, - EMOTE_STATE_FLYFALL = 444, - EMOTE_ONESHOT_FLYDEATH = 445, - EMOTE_STATE_FLY_FALL = 446, - EMOTE_ONESHOT_FLY_SIT_GROUND_DOWN = 447, - EMOTE_ONESHOT_FLY_SIT_GROUND_UP = 448, - EMOTE_ONESHOT_EMERGE = 449, - EMOTE_ONESHOT_DRAGONSPIT = 450, - EMOTE_STATE_SPECIALUNARMED = 451, - EMOTE_ONESHOT_FLYGRAB = 452, - EMOTE_STATE_FLYGRABCLOSED = 453, - EMOTE_ONESHOT_FLYGRABTHROWN = 454, - EMOTE_STATE_FLY_SIT_GROUND = 455, - EMOTE_STATE_WALKBACKWARDS = 456, - EMOTE_ONESHOT_FLYTALK = 457, - EMOTE_ONESHOT_FLYATTACK1H = 458, - EMOTE_STATE_CUSTOMSPELL08 = 459, - EMOTE_ONESHOT_FLY_DRAGONSPIT = 460, - EMOTE_STATE_SIT_CHAIR_LOW = 461, - EMOTE_ONE_SHOT_STUN = 462, - EMOTE_ONESHOT_SPELLCAST_OMNI = 463, - EMOTE_STATE_READYTHROWN = 465, - EMOTE_ONESHOT_WORK_CHOPWOOD = 466, - EMOTE_ONESHOT_WORK_MINING = 467, - EMOTE_STATE_SPELL_CHANNEL_OMNI = 468, - EMOTE_STATE_SPELL_CHANNEL_DIRECTED = 469, - EMOTE_STAND_STATE_NONE = 470, - EMOTE_STATE_READYJOUST = 471, - EMOTE_STATE_STRANGULATE = 473, - EMOTE_STATE_READYSPELLOMNI = 474, - EMOTE_STATE_HOLD_JOUST = 475, - EMOTE_ONESHOT_CRY_JAINA = 476 -}; - + EMOTE_ONESHOT_NONE = 0, + EMOTE_ONESHOT_TALK = 1, + EMOTE_ONESHOT_BOW = 2, + EMOTE_ONESHOT_WAVE = 3, + EMOTE_ONESHOT_CHEER = 4, + EMOTE_ONESHOT_EXCLAMATION = 5, + EMOTE_ONESHOT_QUESTION = 6, + EMOTE_ONESHOT_EAT = 7, + EMOTE_STATE_DANCE = 10, + EMOTE_ONESHOT_LAUGH = 11, + EMOTE_STATE_SLEEP = 12, + EMOTE_STATE_SIT = 13, + EMOTE_ONESHOT_RUDE = 14, + EMOTE_ONESHOT_ROAR = 15, + EMOTE_ONESHOT_KNEEL = 16, + EMOTE_ONESHOT_KISS = 17, + EMOTE_ONESHOT_CRY = 18, + EMOTE_ONESHOT_CHICKEN = 19, + EMOTE_ONESHOT_BEG = 20, + EMOTE_ONESHOT_APPLAUD = 21, + EMOTE_ONESHOT_SHOUT = 22, + EMOTE_ONESHOT_FLEX = 23, + EMOTE_ONESHOT_SHY = 24, + EMOTE_ONESHOT_POINT = 25, + EMOTE_STATE_STAND = 26, + EMOTE_STATE_READY_UNARMED = 27, + EMOTE_STATE_WORK_SHEATHED = 28, + EMOTE_STATE_POINT = 29, + EMOTE_STATE_NONE = 30, + EMOTE_ONESHOT_WOUND = 33, + EMOTE_ONESHOT_WOUND_CRITICAL = 34, + EMOTE_ONESHOT_ATTACK_UNARMED = 35, + EMOTE_ONESHOT_ATTACK1H = 36, + EMOTE_ONESHOT_ATTACK2HTIGHT = 37, + EMOTE_ONESHOT_ATTACK2H_LOOSE = 38, + EMOTE_ONESHOT_PARRY_UNARMED = 39, + EMOTE_ONESHOT_PARRY_SHIELD = 43, + EMOTE_ONESHOT_READY_UNARMED = 44, + EMOTE_ONESHOT_READY1H = 45, + EMOTE_ONESHOT_READY_BOW = 48, + EMOTE_ONESHOT_SPELL_PRECAST = 50, + EMOTE_ONESHOT_SPELL_CAST = 51, + EMOTE_ONESHOT_BATTLE_ROAR = 53, + EMOTE_ONESHOT_SPECIALATTACK1H = 54, + EMOTE_ONESHOT_KICK = 60, + EMOTE_ONESHOT_ATTACK_THROWN = 61, + EMOTE_STATE_STUN = 64, + EMOTE_STATE_DEAD = 65, + EMOTE_ONESHOT_SALUTE = 66, + EMOTE_STATE_KNEEL = 68, + EMOTE_STATE_USE_STANDING = 69, + EMOTE_ONESHOT_WAVE_NO_SHEATHE = 70, + EMOTE_ONESHOT_CHEER_NO_SHEATHE = 71, + EMOTE_ONESHOT_EAT_NO_SHEATHE = 92, + EMOTE_STATE_STUN_NO_SHEATHE = 93, + EMOTE_ONESHOT_DANCE = 94, + EMOTE_ONESHOT_SALUTE_NO_SHEATH = 113, + EMOTE_STATE_USE_STANDING_NO_SHEATHE = 133, + EMOTE_ONESHOT_LAUGH_NO_SHEATHE = 153, + EMOTE_STATE_WORK = 173, + EMOTE_STATE_SPELL_PRECAST = 193, + EMOTE_ONESHOT_READY_RIFLE = 213, + EMOTE_STATE_READY_RIFLE = 214, + EMOTE_STATE_WORK_MINING = 233, + EMOTE_STATE_WORK_CHOPWOOD = 234, + EMOTE_STATE_APPLAUD = 253, + EMOTE_ONESHOT_LIFTOFF = 254, + EMOTE_ONESHOT_YES = 273, + EMOTE_ONESHOT_NO = 274, + EMOTE_ONESHOT_TRAIN = 275, + EMOTE_ONESHOT_LAND = 293, + EMOTE_STATE_AT_EASE = 313, + EMOTE_STATE_READY1H = 333, + EMOTE_STATE_SPELL_KNEEL_START = 353, + EMOTE_STATE_SUBMERGED = 373, + EMOTE_ONESHOT_SUBMERGE = 374, + EMOTE_STATE_READY2H = 375, + EMOTE_STATE_READY_BOW = 376, + EMOTE_ONESHOT_MOUNT_SPECIAL = 377, + EMOTE_STATE_TALK = 378, + EMOTE_STATE_FISHING = 379, + EMOTE_ONESHOT_FISHING = 380, + EMOTE_ONESHOT_LOOT = 381, + EMOTE_STATE_WHIRLWIND = 382, + EMOTE_STATE_DROWNED = 383, + EMOTE_STATE_HOLD_BOW = 384, + EMOTE_STATE_HOLD_RIFLE = 385, + EMOTE_STATE_HOLD_THROWN = 386, + EMOTE_ONESHOT_DROWN = 387, + EMOTE_ONESHOT_STOMP = 388, + EMOTE_ONESHOT_ATTACK_OFF = 389, + EMOTE_ONESHOT_ATTACK_OFF_PIERCE = 390, + EMOTE_STATE_ROAR = 391, + EMOTE_STATE_LAUGH = 392, + EMOTE_ONESHOT_CREATURE_SPECIAL = 393, + EMOTE_ONESHOT_JUMPLANDRUN = 394, + EMOTE_ONESHOT_JUMPEND = 395, + EMOTE_ONESHOT_TALK_NO_SHEATHE = 396, + EMOTE_ONESHOT_POINT_NO_SHEATHE = 397, + EMOTE_STATE_CANNIBALIZE = 398, + EMOTE_ONESHOT_JUMPSTART = 399, + EMOTE_STATE_DANCESPECIAL = 400, + EMOTE_ONESHOT_DANCESPECIAL = 401, + EMOTE_ONESHOT_CUSTOM_SPELL_01 = 402, + EMOTE_ONESHOT_CUSTOM_SPELL_02 = 403, + EMOTE_ONESHOT_CUSTOM_SPELL_03 = 404, + EMOTE_ONESHOT_CUSTOM_SPELL_04 = 405, + EMOTE_ONESHOT_CUSTOM_SPELL_05 = 406, + EMOTE_ONESHOT_CUSTOM_SPELL_06 = 407, + EMOTE_ONESHOT_CUSTOM_SPELL_07 = 408, + EMOTE_ONESHOT_CUSTOM_SPELL_08 = 409, + EMOTE_ONESHOT_CUSTOM_SPELL_09 = 410, + EMOTE_ONESHOT_CUSTOM_SPELL_10 = 411, + EMOTE_STATE_EXCLAIM = 412, + EMOTE_STATE_DANCE_CUSTOM = 413, + EMOTE_STATE_SIT_CHAIR_MED = 415, + EMOTE_STATE_CUSTOM_SPELL_01 = 416, + EMOTE_STATE_CUSTOM_SPELL_02 = 417, + EMOTE_STATE_EAT = 418, + EMOTE_STATE_CUSTOM_SPELL_04 = 419, + EMOTE_STATE_CUSTOM_SPELL_03 = 420, + EMOTE_STATE_CUSTOM_SPELL_05 = 421, + EMOTE_STATE_SPELLEFFECT_HOLD = 422, + EMOTE_STATE_EAT_NO_SHEATHE = 423, + EMOTE_STATE_MOUNT = 424, + EMOTE_STATE_READY2HL = 425, + EMOTE_STATE_SIT_CHAIR_HIGH = 426, + EMOTE_STATE_FALL = 427, + EMOTE_STATE_LOOT = 428, + EMOTE_STATE_SUBMERGED_NEW = 429, + EMOTE_ONESHOT_COWER = 430, + EMOTE_STATE_COWER = 431, + EMOTE_ONESHOT_USE_STANDING = 432, + EMOTE_STATE_STEALTH_STAND = 433, + EMOTE_ONESHOT_OMNICAST_GHOUL = 434, + EMOTE_ONESHOT_ATTACK_BOW = 435, + EMOTE_ONESHOT_ATTACK_RIFLE = 436, + EMOTE_STATE_SWIM_IDLE = 437, + EMOTE_STATE_ATTACK_UNARMED = 438, + EMOTE_ONESHOT_SPELL_CAST_W_SOUND = 439, + EMOTE_ONESHOT_DODGE = 440, + EMOTE_ONESHOT_PARRY1H = 441, + EMOTE_ONESHOT_PARRY2H = 442, + EMOTE_ONESHOT_PARRY2HL = 443, + EMOTE_STATE_FLYFALL = 444, + EMOTE_ONESHOT_FLYDEATH = 445, + EMOTE_STATE_FLY_FALL = 446, + EMOTE_ONESHOT_FLY_SIT_GROUND_DOWN = 447, + EMOTE_ONESHOT_FLY_SIT_GROUND_UP = 448, + EMOTE_ONESHOT_EMERGE = 449, + EMOTE_ONESHOT_DRAGON_SPIT = 450, + EMOTE_STATE_SPECIAL_UNARMED = 451, + EMOTE_ONESHOT_FLYGRAB = 452, + EMOTE_STATE_FLYGRABCLOSED = 453, + EMOTE_ONESHOT_FLYGRABTHROWN = 454, + EMOTE_STATE_FLY_SIT_GROUND = 455, + EMOTE_STATE_WALK_BACKWARDS = 456, + EMOTE_ONESHOT_FLYTALK = 457, + EMOTE_ONESHOT_FLYATTACK1H = 458, + EMOTE_STATE_CUSTOM_SPELL_08 = 459, + EMOTE_ONESHOT_FLY_DRAGON_SPIT = 460, + EMOTE_STATE_SIT_CHAIR_LOW = 461, + EMOTE_ONESHOT_STUN = 462, + EMOTE_ONESHOT_SPELL_CAST_OMNI = 463, + EMOTE_STATE_READY_THROWN = 465, + EMOTE_ONESHOT_WORK_CHOPWOOD = 466, + EMOTE_ONESHOT_WORK_MINING = 467, + EMOTE_STATE_SPELL_CHANNEL_OMNI = 468, + EMOTE_STATE_SPELL_CHANNEL_DIRECTED = 469, + EMOTE_STAND_STATE_NONE = 470, + EMOTE_STATE_READYJOUST = 471, + EMOTE_STATE_STRANGULATE = 473, + EMOTE_STATE_READY_SPELL_OMNI = 474, + EMOTE_STATE_HOLD_JOUST = 475, + EMOTE_ONESHOT_CRY_JAINA = 476 +}; + +// AnimationData.dbc enum Anim { - ANIM_STAND = 0x0, - ANIM_DEATH = 0x1, - ANIM_SPELL = 0x2, - ANIM_STOP = 0x3, - ANIM_WALK = 0x4, - ANIM_RUN = 0x5, - ANIM_DEAD = 0x6, - ANIM_RISE = 0x7, - ANIM_STANDWOUND = 0x8, - ANIM_COMBATWOUND = 0x9, - ANIM_COMBATCRITICAL = 0xA, - ANIM_SHUFFLE_LEFT = 0xB, - ANIM_SHUFFLE_RIGHT = 0xC, - ANIM_WALK_BACKWARDS = 0xD, - ANIM_STUN = 0xE, - ANIM_HANDS_CLOSED = 0xF, - ANIM_ATTACKUNARMED = 0x10, - ANIM_ATTACK1H = 0x11, - ANIM_ATTACK2HTIGHT = 0x12, - ANIM_ATTACK2HLOOSE = 0x13, - ANIM_PARRYUNARMED = 0x14, - ANIM_PARRY1H = 0x15, - ANIM_PARRY2HTIGHT = 0x16, - ANIM_PARRY2HLOOSE = 0x17, - ANIM_PARRYSHIELD = 0x18, - ANIM_READYUNARMED = 0x19, - ANIM_READY1H = 0x1A, - ANIM_READY2HTIGHT = 0x1B, - ANIM_READY2HLOOSE = 0x1C, - ANIM_READYBOW = 0x1D, - ANIM_DODGE = 0x1E, - ANIM_SPELLPRECAST = 0x1F, - ANIM_SPELLCAST = 0x20, - ANIM_SPELLCASTAREA = 0x21, - ANIM_NPCWELCOME = 0x22, - ANIM_NPCGOODBYE = 0x23, - ANIM_BLOCK = 0x24, - ANIM_JUMPSTART = 0x25, - ANIM_JUMP = 0x26, - ANIM_JUMPEND = 0x27, - ANIM_FALL = 0x28, - ANIM_SWIMIDLE = 0x29, - ANIM_SWIM = 0x2A, - ANIM_SWIM_LEFT = 0x2B, - ANIM_SWIM_RIGHT = 0x2C, - ANIM_SWIM_BACKWARDS = 0x2D, - ANIM_ATTACKBOW = 0x2E, - ANIM_FIREBOW = 0x2F, - ANIM_READYRIFLE = 0x30, - ANIM_ATTACKRIFLE = 0x31, - ANIM_LOOT = 0x32, - ANIM_SPELL_PRECAST_DIRECTED = 0x33, - ANIM_SPELL_PRECAST_OMNI = 0x34, - ANIM_SPELL_CAST_DIRECTED = 0x35, - ANIM_SPELL_CAST_OMNI = 0x36, - ANIM_SPELL_BATTLEROAR = 0x37, - ANIM_SPELL_READYABILITY = 0x38, - ANIM_SPELL_SPECIAL1H = 0x39, - ANIM_SPELL_SPECIAL2H = 0x3A, - ANIM_SPELL_SHIELDBASH = 0x3B, - ANIM_EMOTE_TALK = 0x3C, - ANIM_EMOTE_EAT = 0x3D, - ANIM_EMOTE_WORK = 0x3E, - ANIM_EMOTE_USE_STANDING = 0x3F, - ANIM_EMOTE_EXCLAMATION = 0x40, - ANIM_EMOTE_QUESTION = 0x41, - ANIM_EMOTE_BOW = 0x42, - ANIM_EMOTE_WAVE = 0x43, - ANIM_EMOTE_CHEER = 0x44, - ANIM_EMOTE_DANCE = 0x45, - ANIM_EMOTE_LAUGH = 0x46, - ANIM_EMOTE_SLEEP = 0x47, - ANIM_EMOTE_SIT_GROUND = 0x48, - ANIM_EMOTE_RUDE = 0x49, - ANIM_EMOTE_ROAR = 0x4A, - ANIM_EMOTE_KNEEL = 0x4B, - ANIM_EMOTE_KISS = 0x4C, - ANIM_EMOTE_CRY = 0x4D, - ANIM_EMOTE_CHICKEN = 0x4E, - ANIM_EMOTE_BEG = 0x4F, - ANIM_EMOTE_APPLAUD = 0x50, - ANIM_EMOTE_SHOUT = 0x51, - ANIM_EMOTE_FLEX = 0x52, - ANIM_EMOTE_SHY = 0x53, - ANIM_EMOTE_POINT = 0x54, - ANIM_ATTACK1HPIERCE = 0x55, - ANIM_ATTACK2HLOOSEPIERCE = 0x56, - ANIM_ATTACKOFF = 0x57, - ANIM_ATTACKOFFPIERCE = 0x58, - ANIM_SHEATHE = 0x59, - ANIM_HIPSHEATHE = 0x5A, - ANIM_MOUNT = 0x5B, - ANIM_RUN_LEANRIGHT = 0x5C, - ANIM_RUN_LEANLEFT = 0x5D, - ANIM_MOUNT_SPECIAL = 0x5E, - ANIM_KICK = 0x5F, - ANIM_SITDOWN = 0x60, - ANIM_SITTING = 0x61, - ANIM_SITUP = 0x62, - ANIM_SLEEPDOWN = 0x63, - ANIM_SLEEPING = 0x64, - ANIM_SLEEPUP = 0x65, - ANIM_SITCHAIRLOW = 0x66, - ANIM_SITCHAIRMEDIUM = 0x67, - ANIM_SITCHAIRHIGH = 0x68, - ANIM_LOADBOW = 0x69, - ANIM_LOADRIFLE = 0x6A, - ANIM_ATTACKTHROWN = 0x6B, - ANIM_READYTHROWN = 0x6C, - ANIM_HOLDBOW = 0x6D, - ANIM_HOLDRIFLE = 0x6E, - ANIM_HOLDTHROWN = 0x6F, - ANIM_LOADTHROWN = 0x70, - ANIM_EMOTE_SALUTE = 0x71, - ANIM_KNEELDOWN = 0x72, - ANIM_KNEELING = 0x73, - ANIM_KNEELUP = 0x74, - ANIM_ATTACKUNARMEDOFF = 0x75, - ANIM_SPECIALUNARMED = 0x76, - ANIM_STEALTHWALK = 0x77, - ANIM_STEALTHSTAND = 0x78, - ANIM_KNOCKDOWN = 0x79, - ANIM_EATING = 0x7A, - ANIM_USESTANDINGLOOP = 0x7B, - ANIM_CHANNELCASTDIRECTED = 0x7C, - ANIM_CHANNELCASTOMNI = 0x7D, - ANIM_WHIRLWIND = 0x7E, - ANIM_BIRTH = 0x7F, - ANIM_USESTANDINGSTART = 0x80, - ANIM_USESTANDINGEND = 0x81, - ANIM_HOWL = 0x82, - ANIM_DROWN = 0x83, - ANIM_DROWNED = 0x84, - ANIM_FISHINGCAST = 0x85, - ANIM_FISHINGLOOP = 0x86, - ANIM_FLY = 0x87, - ANIM_EMOTE_WORK_NO_SHEATHE = 0x88, - ANIM_EMOTE_STUN_NO_SHEATHE = 0x89, - ANIM_EMOTE_USE_STANDING_NO_SHEATHE= 0x8A, - ANIM_SPELL_SLEEP_DOWN = 0x8B, - ANIM_SPELL_KNEEL_START = 0x8C, - ANIM_SPELL_KNEEL_LOOP = 0x8D, - ANIM_SPELL_KNEEL_END = 0x8E, - ANIM_SPRINT = 0x8F, - ANIM_IN_FIGHT = 0x90, - - ANIM_GAMEOBJ_SPAWN = 145, - ANIM_GAMEOBJ_CLOSE = 146, - ANIM_GAMEOBJ_CLOSED = 147, - ANIM_GAMEOBJ_OPEN = 148, - ANIM_GAMEOBJ_OPENED = 149, - ANIM_GAMEOBJ_DESTROY = 150, - ANIM_GAMEOBJ_DESTROYED = 151, - ANIM_GAMEOBJ_REBUILD = 152, - ANIM_GAMEOBJ_CUSTOM0 = 153, - ANIM_GAMEOBJ_CUSTOM1 = 154, - ANIM_GAMEOBJ_CUSTOM2 = 155, - ANIM_GAMEOBJ_CUSTOM3 = 156, - ANIM_GAMEOBJ_DESPAWN = 157, - ANIM_HOLD = 158, - ANIM_DECAY = 159, - ANIM_BOWPULL = 160, - ANIM_BOWRELEASE = 161, - ANIM_SHIPSTART = 162, - ANIM_SHIPMOVEING = 163, - ANIM_SHIPSTOP = 164, - ANIM_GROUPARROW = 165, - ANIM_ARROW = 166, - ANIM_CORPSEARROW = 167, - ANIM_GUIDEARROW = 168, - ANIM_SWAY = 169, - ANIM_DRUIDCATPOUNCE = 170, - ANIM_DRUIDCATRIP = 171, - ANIM_DRUIDCATRAKE = 172, - ANIM_DRUIDCATRAVAGE = 173, - ANIM_DRUIDCATCLAW = 174, - ANIM_DRUIDCATCOWER = 175, - ANIM_DRUIDBEARSWIPE = 176, - ANIM_DRUIDBEARBITE = 177, - ANIM_DRUIDBEARMAUL = 178, - ANIM_DRUIDBEARBASH = 179, - ANIM_DRAGONTAIL = 180, - ANIM_DRAGONSTOMP = 181, - ANIM_DRAGONSPIT = 182, - ANIM_DRAGONSPITHOVER = 183, - ANIM_DRAGONSPITFLY = 184, - ANIM_EMOTEYES = 185, - ANIM_EMOTENO = 186, - ANIM_JUMPLANDRUN = 187, - ANIM_LOOTHOLD = 188, - ANIM_LOOTUP = 189, - ANIM_STANDHIGH = 190, - ANIM_IMPACT = 191, - ANIM_LIFTOFF = 192, - ANIM_HOVER = 193, - ANIM_SUCCUBUSENTICE = 194, - ANIM_EMOTETRAIN = 195, - ANIM_EMOTEDEAD = 196, - ANIM_EMOTEDANCEONCE = 197, - ANIM_DEFLECT = 198, - ANIM_EMOTEEATNOSHEATHE = 199, - ANIM_LAND = 200, - ANIM_SUBMERGE = 201, - ANIM_SUBMERGED = 202, - ANIM_CANNIBALIZE = 203, - ANIM_ARROWBIRTH = 204, - ANIM_GROURARROWBIRTH = 205, - ANIM_CORPSEARROWBIRTH = 206, - ANIM_GUIDEARROWBIRTH = 207, - ANIM_EMOTETALKNOSHEATHE = 208, - ANIM_EMOTEPOINTNOSHEATHE = 209, - ANIM_EMOTESALUTENOSHEATHE = 210, - ANIM_EMOTEDANCESPECIAL = 211, - ANIM_MUTILATE = 212, - ANIM_CUSTOMSPELL01 = 213, - ANIM_CUSTOMSPELL02 = 214, - ANIM_CUSTOMSPELL03 = 215, - ANIM_CUSTOMSPELL04 = 216, - ANIM_CUSTOMSPELL05 = 217, - ANIM_CUSTOMSPELL06 = 218, - ANIM_CUSTOMSPELL07 = 219, - ANIM_CUSTOMSPELL08 = 220, - ANIM_CUSTOMSPELL09 = 221, - ANIM_CUSTOMSPELL10 = 222, - ANIM_StealthRun = 223 + ANIM_STAND = 0, + ANIM_DEATH = 1, + ANIM_SPELL = 2, + ANIM_STOP = 3, + ANIM_WALK = 4, + ANIM_RUN = 5, + ANIM_DEAD = 6, + ANIM_RISE = 7, + ANIM_STAND_WOUND = 8, + ANIM_COMBAT_WOUND = 9, + ANIM_COMBAT_CRITICAL = 10, + ANIM_SHUFFLE_LEFT = 11, + ANIM_SHUFFLE_RIGHT = 12, + ANIM_WALK_BACKWARDS = 13, + ANIM_STUN = 14, + ANIM_HANDS_CLOSED = 15, + ANIM_ATTACK_UNARMED = 16, + ANIM_ATTACK1H = 17, + ANIM_ATTACK2H = 18, + ANIM_ATTACK2HL = 19, + ANIM_PARRY_UNARMED = 20, + ANIM_PARRY1H = 21, + ANIM_PARRY2H = 22, + ANIM_PARRY2HL = 23, + ANIM_SHIELD_BLOCK = 24, + ANIM_READY_UNARMED = 25, + ANIM_READY1H = 26, + ANIM_READY2H = 27, + ANIM_READY2HL = 28, + ANIM_READY_BOW = 29, + ANIM_DODGE = 30, + ANIM_SPELL_PRECAST = 31, + ANIM_SPELL_CAST = 32, + ANIM_SPELL_CAST_AREA = 33, + ANIM_NPC_WELCOME = 34, + ANIM_NPC_GOODBYE = 35, + ANIM_BLOCK = 36, + ANIM_JUMP_START = 37, + ANIM_JUMP = 38, + ANIM_JUMP_END = 39, + ANIM_FALL = 40, + ANIM_SWIM_IDLE = 41, + ANIM_SWIM = 42, + ANIM_SWIM_LEFT = 43, + ANIM_SWIM_RIGHT = 44, + ANIM_SWIM_BACKWARDS = 45, + ANIM_ATTACK_BOW = 46, + ANIM_FIRE_BOW = 47, + ANIM_READY_RIFLE = 48, + ANIM_ATTACK_RIFLE = 49, + ANIM_LOOT = 50, + ANIM_READY_SPELL_DIRECTED = 51, + ANIM_READY_SPELL_OMNI = 52, + ANIM_SPELL_CAST_DIRECTED = 53, + ANIM_SPELL_CAST_OMNI = 54, + ANIM_BATTLE_ROAR = 55, + ANIM_READY_ABILITY = 56, + ANIM_SPECIAL1H = 57, + ANIM_SPECIAL2H = 58, + ANIM_SHIELD_BASH = 59, + ANIM_EMOTE_TALK = 60, + ANIM_EMOTE_EAT = 61, + ANIM_EMOTE_WORK = 62, + ANIM_EMOTE_USE_STANDING = 63, + ANIM_EMOTE_TALK_EXCLAMATION = 64, + ANIM_EMOTE_TALK_QUESTION = 65, + ANIM_EMOTE_BOW = 66, + ANIM_EMOTE_WAVE = 67, + ANIM_EMOTE_CHEER = 68, + ANIM_EMOTE_DANCE = 69, + ANIM_EMOTE_LAUGH = 70, + ANIM_EMOTE_SLEEP = 71, + ANIM_EMOTE_SIT_GROUND = 72, + ANIM_EMOTE_RUDE = 73, + ANIM_EMOTE_ROAR = 74, + ANIM_EMOTE_KNEEL = 75, + ANIM_EMOTE_KISS = 76, + ANIM_EMOTE_CRY = 77, + ANIM_EMOTE_CHICKEN = 78, + ANIM_EMOTE_BEG = 79, + ANIM_EMOTE_APPLAUD = 80, + ANIM_EMOTE_SHOUT = 81, + ANIM_EMOTE_FLEX = 82, + ANIM_EMOTE_SHY = 83, + ANIM_EMOTE_POINT = 84, + ANIM_ATTACK1H_PIERCE = 85, + ANIM_ATTACK2H_LOOSE_PIERCE = 86, + ANIM_ATTACK_OFF = 87, + ANIM_ATTACK_OFF_PIERCE = 88, + ANIM_SHEATHE = 89, + ANIM_HIP_SHEATHE = 90, + ANIM_MOUNT = 91, + ANIM_RUN_RIGHT = 92, + ANIM_RUN_LEFT = 93, + ANIM_MOUNT_SPECIAL = 94, + ANIM_KICK = 95, + ANIM_SIT_GROUND_DOWN = 96, + ANIM_SIT_GROUND = 97, + ANIM_SIT_GROUND_UP = 98, + ANIM_SLEEP_DOWN = 99, + ANIM_SLEEP = 100, + ANIM_SLEEP_UP = 101, + ANIM_SIT_CHAIR_LOW = 102, + ANIM_SIT_CHAIR_MED = 103, + ANIM_SIT_CHAIR_HIGH = 104, + ANIM_LOAD_BOW = 105, + ANIM_LOAD_RIFLE = 106, + ANIM_ATTACK_THROWN = 107, + ANIM_READY_THROWN = 108, + ANIM_HOLD_BOW = 109, + ANIM_HOLD_RIFLE = 110, + ANIM_HOLD_THROWN = 111, + ANIM_LOAD_THROWN = 112, + ANIM_EMOTE_SALUTE = 113, + ANIM_KNEEL_START = 114, + ANIM_KNEEL_LOOP = 115, + ANIM_KNEEL_END = 116, + ANIM_ATTACK_UNARMED_OFF = 117, + ANIM_SPECIAL_UNARMED = 118, + ANIM_STEALTH_WALK = 119, + ANIM_STEALTH_STAND = 120, + ANIM_KNOCKDOWN = 121, + ANIM_EATING_LOOP = 122, + ANIM_USE_STANDING_LOOP = 123, + ANIM_CHANNEL_CAST_DIRECTED = 124, + ANIM_CHANNEL_CAST_OMNI = 125, + ANIM_WHIRLWIND = 126, + ANIM_BIRTH = 127, + ANIM_USE_STANDING_START = 128, + ANIM_USE_STANDING_END = 129, + ANIM_CREATURE_SPECIAL = 130, + ANIM_DROWN = 131, + ANIM_DROWNED = 132, + ANIM_FISHING_CAST = 133, + ANIM_FISHING_LOOP = 134, + ANIM_FLY = 135, + ANIM_EMOTE_WORK_NO_SHEATHE = 136, + ANIM_EMOTE_STUN_NO_SHEATHE = 137, + ANIM_EMOTE_USE_STANDING_NO_SHEATHE = 138, + ANIM_SPELL_SLEEP_DOWN = 139, + ANIM_SPELL_KNEEL_START = 140, + ANIM_SPELL_KNEEL_LOOP = 141, + ANIM_SPELL_KNEEL_END = 142, + ANIM_SPRINT = 143, + ANIM_IN_FIGHT = 144, + ANIM_SPAWN = 145, + ANIM_CLOSE = 146, + ANIM_CLOSED = 147, + ANIM_OPEN = 148, + ANIM_OPENED = 149, + ANIM_DESTROY = 150, + ANIM_DESTROYED = 151, + ANIM_REBUILD = 152, + ANIM_CUSTOM_0 = 153, + ANIM_CUSTOM_1 = 154, + ANIM_CUSTOM_2 = 155, + ANIM_CUSTOM_3 = 156, + ANIM_DESPAWN = 157, + ANIM_HOLD = 158, + ANIM_DECAY = 159, + ANIM_BOW_PULL = 160, + ANIM_BOW_RELEASE = 161, + ANIM_SHIP_START = 162, + ANIM_SHIP_MOVING = 163, + ANIM_SHIP_STOP = 164, + ANIM_GROUP_ARROW = 165, + ANIM_ARROW = 166, + ANIM_CORPSE_ARROW = 167, + ANIM_GUIDE_ARROW = 168, + ANIM_SWAY = 169, + ANIM_DRUID_CAT_POUNCE = 170, + ANIM_DRUID_CAT_RIP = 171, + ANIM_DRUID_CAT_RAKE = 172, + ANIM_DRUID_CAT_RAVAGE = 173, + ANIM_DRUID_CAT_CLAW = 174, + ANIM_DRUID_CAT_COWER = 175, + ANIM_DRUID_BEAR_SWIPE = 176, + ANIM_DRUID_BEAR_BITE = 177, + ANIM_DRUID_BEAR_MAUL = 178, + ANIM_DRUID_BEAR_BASH = 179, + ANIM_DRAGON_TAIL = 180, + ANIM_DRAGON_STOMP = 181, + ANIM_DRAGON_SPIT = 182, + ANIM_DRAGON_SPIT_HOVER = 183, + ANIM_DRAGON_SPIT_FLY = 184, + ANIM_EMOTE_YES = 185, + ANIM_EMOTE_NO = 186, + ANIM_JUMP_LAND_RUN = 187, + ANIM_LOOT_HOLD = 188, + ANIM_LOOT_UP = 189, + ANIM_STAND_HIGH = 190, + ANIM_IMPACT = 191, + ANIM_LIFTOFF = 192, + ANIM_HOVER = 193, + ANIM_SUCCUBUS_ENTICE = 194, + ANIM_EMOTE_TRAIN = 195, + ANIM_EMOTE_DEAD = 196, + ANIM_EMOTE_DANCE_ONCE = 197, + ANIM_DEFLECT = 198, + ANIM_EMOTE_EAT_NO_SHEATHE = 199, + ANIM_LAND = 200, + ANIM_SUBMERGE = 201, + ANIM_SUBMERGED = 202, + ANIM_CANNIBALIZE = 203, + ANIM_ARROW_BIRTH = 204, + ANIM_GROUP_ARROW_BIRTH = 205, + ANIM_CORPSE_ARROW_BIRTH = 206, + ANIM_GUIDE_ARROW_BIRTH = 207, + ANIM_EMOTE_TALK_NO_SHEATHE = 208, + ANIM_EMOTE_POINT_NO_SHEATHE = 209, + ANIM_EMOTE_SALUTE_NO_SHEATHE = 210, + ANIM_EMOTE_DANCE_SPECIAL = 211, + ANIM_MUTILATE = 212, + ANIM_CUSTOM_SPELL_01 = 213, + ANIM_CUSTOM_SPELL_02 = 214, + ANIM_CUSTOM_SPELL_03 = 215, + ANIM_CUSTOM_SPELL_04 = 216, + ANIM_CUSTOM_SPELL_05 = 217, + ANIM_CUSTOM_SPELL_06 = 218, + ANIM_CUSTOM_SPELL_07 = 219, + ANIM_CUSTOM_SPELL_08 = 220, + ANIM_CUSTOM_SPELL_09 = 221, + ANIM_CUSTOM_SPELL_10 = 222, + ANIM_STEALTH_RUN = 223, + ANIM_EMERGE = 224, + ANIM_COWER = 225, + ANIM_GRAB = 226, + ANIM_GRAB_CLOSED = 227, + ANIM_GRAB_THROWN = 228, + ANIM_FLY_STAND = 229, + ANIM_FLY_DEATH = 230, + ANIM_FLY_SPELL = 231, + ANIM_FLY_STOP = 232, + ANIM_FLY_WALK = 233, + ANIM_FLY_RUN = 234, + ANIM_FLY_DEAD = 235, + ANIM_FLY_RISE = 236, + ANIM_FLY_STAND_WOUND = 237, + ANIM_FLY_COMBAT_WOUND = 238, + ANIM_FLY_COMBAT_CRITICAL = 239, + ANIM_FLY_SHUFFLE_LEFT = 240, + ANIM_FLY_SHUFFLE_RIGHT = 241, + ANIM_FLY_WALK_BACKWARDS = 242, + ANIM_FLY_STUN = 243, + ANIM_FLY_HANDS_CLOSED = 244, + ANIM_FLY_ATTACK_UNARMED = 245, + ANIM_FLY_ATTACK1H = 246, + ANIM_FLY_ATTACK2H = 247, + ANIM_FLY_ATTACK2HL = 248, + ANIM_FLY_PARRY_UNARMED = 249, + ANIM_FLY_PARRY1H = 250, + ANIM_FLY_PARRY2H = 251, + ANIM_FLY_PARRY2HL = 252, + ANIM_FLY_SHIELD_BLOCK = 253, + ANIM_FLY_READY_UNARMED = 254, + ANIM_FLY_READY1H = 255, + ANIM_FLY_READY2H = 256, + ANIM_FLY_READY2HL = 257, + ANIM_FLY_READY_BOW = 258, + ANIM_FLY_DODGE = 259, + ANIM_FLY_SPELL_PRECAST = 260, + ANIM_FLY_SPELL_CAST = 261, + ANIM_FLY_SPELL_CAST_AREA = 262, + ANIM_FLY_NPC_WELCOME = 263, + ANIM_FLY_NPC_GOODBYE = 264, + ANIM_FLY_BLOCK = 265, + ANIM_FLY_JUMP_START = 266, + ANIM_FLY_JUMP = 267, + ANIM_FLY_JUMP_END = 268, + ANIM_FLY_FALL = 269, + ANIM_FLY_SWIM_IDLE = 270, + ANIM_FLY_SWIM = 271, + ANIM_FLY_SWIM_LEFT = 272, + ANIM_FLY_SWIM_RIGHT = 273, + ANIM_FLY_SWIM_BACKWARDS = 274, + ANIM_FLY_ATTACK_BOW = 275, + ANIM_FLY_FIRE_BOW = 276, + ANIM_FLY_READY_RIFLE = 277, + ANIM_FLY_ATTACK_RIFLE = 278, + ANIM_FLY_LOOT = 279, + ANIM_FLY_READY_SPELL_DIRECTED = 280, + ANIM_FLY_READY_SPELL_OMNI = 281, + ANIM_FLY_SPELL_CAST_DIRECTED = 282, + ANIM_FLY_SPELL_CAST_OMNI = 283, + ANIM_FLY_SPELL_BATTLE_ROAR = 284, + ANIM_FLY_READY_ABILITY = 285, + ANIM_FLY_SPECIAL1H = 286, + ANIM_FLY_SPECIAL2H = 287, + ANIM_FLY_SHIELD_BASH = 288, + ANIM_FLY_EMOTE_TALK = 289, + ANIM_FLY_EMOTE_EAT = 290, + ANIM_FLY_EMOTE_WORK = 291, + ANIM_FLY_USE_STANDING = 292, + ANIM_FLY_EMOTE_TALK_EXCLAMATION = 293, + ANIM_FLY_EMOTE_TALK_QUESTION = 294, + ANIM_FLY_EMOTE_BOW = 295, + ANIM_FLY_EMOTE_WAVE = 296, + ANIM_FLY_EMOTE_CHEER = 297, + ANIM_FLY_EMOTE_DANCE = 298, + ANIM_FLY_EMOTE_LAUGH = 299, + ANIM_FLY_EMOTE_SLEEP = 300, + ANIM_FLY_EMOTE_SIT_GROUND = 301, + ANIM_FLY_EMOTE_RUDE = 302, + ANIM_FLY_EMOTE_ROAR = 303, + ANIM_FLY_EMOTE_KNEEL = 304, + ANIM_FLY_EMOTE_KISS = 305, + ANIM_FLY_EMOTE_CRY = 306, + ANIM_FLY_EMOTE_CHICKEN = 307, + ANIM_FLY_EMOTE_BEG = 308, + ANIM_FLY_EMOTE_APPLAUD = 309, + ANIM_FLY_EMOTE_SHOUT = 310, + ANIM_FLY_EMOTE_FLEX = 311, + ANIM_FLY_EMOTE_SHY = 312, + ANIM_FLY_EMOTE_POINT = 313, + ANIM_FLY_ATTACK1H_PIERCE = 314, + ANIM_FLY_ATTACK2H_LOOSE_PIERCE = 315, + ANIM_FLY_ATTACK_OFF = 316, + ANIM_FLY_ATTACK_OFF_PIERCE = 317, + ANIM_FLY_SHEATH = 318, + ANIM_FLY_HIP_SHEATH = 319, + ANIM_FLY_MOUNT = 320, + ANIM_FLY_RUN_RIGHT = 321, + ANIM_FLY_RUN_LEFT = 322, + ANIM_FLY_MOUNT_SPECIAL = 323, + ANIM_FLY_KICK = 324, + ANIM_FLY_SIT_GROUND_DOWN = 325, + ANIM_FLY_SIT_GROUND = 326, + ANIM_FLY_SIT_GROUND_UP = 327, + ANIM_FLY_SLEEP_DOWN = 328, + ANIM_FLY_SLEEP = 329, + ANIM_FLY_SLEEP_UP = 330, + ANIM_FLY_SIT_CHAIR_LOW = 331, + ANIM_FLY_SIT_CHAIR_MED = 332, + ANIM_FLY_SIT_CHAIR_HIGH = 333, + ANIM_FLY_LOAD_BOW = 334, + ANIM_FLY_LOAD_RIFLE = 335, + ANIM_FLY_ATTACK_THROWN = 336, + ANIM_FLY_READY_THROWN = 337, + ANIM_FLY_HOLD_BOW = 338, + ANIM_FLY_HOLD_RIFLE = 339, + ANIM_FLY_HOLD_THROWN = 340, + ANIM_FLY_LOAD_THROWN = 341, + ANIM_FLY_EMOTE_SALUTE = 342, + ANIM_FLY_KNEEL_START = 343, + ANIM_FLY_KNEEL_LOOP = 344, + ANIM_FLY_KNEEL_END = 345, + ANIM_FLY_ATTACK_UNARMED_OFF = 346, + ANIM_FLY_SPECIAL_UNARMED = 347, + ANIM_FLY_STEALTH_WALK = 348, + ANIM_FLY_STEALTH_STAND = 349, + ANIM_FLY_KNOCKDOWN = 350, + ANIM_FLY_EATING_LOOP = 351, + ANIM_FLY_USE_STANDING_LOOP = 352, + ANIM_FLY_CHANNEL_CAST_DIRECTED = 353, + ANIM_FLY_CHANNEL_CAST_OMNI = 354, + ANIM_FLY_WHIRLWIND = 355, + ANIM_FLY_BIRTH = 356, + ANIM_FLY_USE_STANDING_START = 357, + ANIM_FLY_USE_STANDING_END = 358, + ANIM_FLY_CREATURE_SPECIAL = 359, + ANIM_FLY_DROWN = 360, + ANIM_FLY_DROWNED = 361, + ANIM_FLY_FISHING_CAST = 362, + ANIM_FLY_FISHING_LOOP = 363, + ANIM_FLY_FLY = 364, + ANIM_FLY_EMOTE_WORK_NO_SHEATHE = 365, + ANIM_FLY_EMOTE_STUN_NO_SHEATHE = 366, + ANIM_FLY_EMOTE_USE_STANDING_NO_SHEATHE = 367, + ANIM_FLY_SPELL_SLEEP_DOWN = 368, + ANIM_FLY_SPELL_KNEEL_START = 369, + ANIM_FLY_SPELL_KNEEL_LOOP = 370, + ANIM_FLY_SPELL_KNEEL_END = 371, + ANIM_FLY_SPRINT = 372, + ANIM_FLY_IN_FLIGHT = 373, + ANIM_FLY_SPAWN = 374, + ANIM_FLY_CLOSE = 375, + ANIM_FLY_CLOSED = 376, + ANIM_FLY_OPEN = 377, + ANIM_FLY_OPENED = 378, + ANIM_FLY_DESTROY = 379, + ANIM_FLY_DESTROYED = 380, + ANIM_FLY_REBUILD = 381, + ANIM_FLY_CUSTOM_0 = 382, + ANIM_FLY_CUSTOM_1 = 383, + ANIM_FLY_CUSTOM_2 = 384, + ANIM_FLY_CUSTOM_3 = 385, + ANIM_FLY_DESPAWN = 386, + ANIM_FLY_HOLD = 387, + ANIM_FLY_DECAY = 388, + ANIM_FLY_BOW_PULL = 389, + ANIM_FLY_BOW_RELEASE = 390, + ANIM_FLY_SHIP_START = 391, + ANIM_FLY_SHIP_MOVING = 392, + ANIM_FLY_SHIP_STOP = 393, + ANIM_FLY_GROUP_ARROW = 394, + ANIM_FLY_ARROW = 395, + ANIM_FLY_CORPSE_ARROW = 396, + ANIM_FLY_GUIDE_ARROW = 397, + ANIM_FLY_SWAY = 398, + ANIM_FLY_DRUID_CAT_POUNCE = 399, + ANIM_FLY_DRUID_CAT_RIP = 400, + ANIM_FLY_DRUID_CAT_RAKE = 401, + ANIM_FLY_DRUID_CAT_RAVAGE = 402, + ANIM_FLY_DRUID_CAT_CLAW = 403, + ANIM_FLY_DRUID_CAT_COWER = 404, + ANIM_FLY_DRUID_BEAR_SWIPE = 405, + ANIM_FLY_DRUID_BEAR_BITE = 406, + ANIM_FLY_DRUID_BEAR_MAUL = 407, + ANIM_FLY_DRUID_BEAR_BASH = 408, + ANIM_FLY_DRAGON_TAIL = 409, + ANIM_FLY_DRAGON_STOMP = 410, + ANIM_FLY_DRAGON_SPIT = 411, + ANIM_FLY_DRAGON_SPIT_HOVER = 412, + ANIM_FLY_DRAGON_SPIT_FLY = 413, + ANIM_FLY_EMOTE_YES = 414, + ANIM_FLY_EMOTE_NO = 415, + ANIM_FLY_JUMP_LAND_RUN = 416, + ANIM_FLY_LOOT_HOLD = 417, + ANIM_FLY_LOOT_UP = 418, + ANIM_FLY_STAND_HIGH = 419, + ANIM_FLY_IMPACT = 420, + ANIM_FLY_LIFTOFF = 421, + ANIM_FLY_HOVER = 422, + ANIM_FLY_SUCCUBUS_ENTICE = 423, + ANIM_FLY_EMOTE_TRAIN = 424, + ANIM_FLY_EMOTE_DEAD = 425, + ANIM_FLY_EMOTE_DANCE_ONCE = 426, + ANIM_FLY_DEFLECT = 427, + ANIM_FLY_EMOTE_EAT_NO_SHEATHE = 428, + ANIM_FLY_LAND = 429, + ANIM_FLY_SUBMERGE = 430, + ANIM_FLY_SUBMERGED = 431, + ANIM_FLY_CANNIBALIZE = 432, + ANIM_FLY_ARROW_BIRTH = 433, + ANIM_FLY_GROUP_ARROW_BIRTH = 434, + ANIM_FLY_CORPSE_ARROW_BIRTH = 435, + ANIM_FLY_GUIDE_ARROW_BIRTH = 436, + ANIM_FLY_EMOTE_TALK_NO_SHEATHE = 437, + ANIM_FLY_EMOTE_POINT_NO_SHEATHE = 438, + ANIM_FLY_EMOTE_SALUTE_NO_SHEATHE = 439, + ANIM_FLY_EMOTE_DANCE_SPECIAL = 440, + ANIM_FLY_MUTILATE = 441, + ANIM_FLY_CUSTOM_SPELL_01 = 442, + ANIM_FLY_CUSTOM_SPELL_02 = 443, + ANIM_FLY_CUSTOM_SPELL_03 = 444, + ANIM_FLY_CUSTOM_SPELL_04 = 445, + ANIM_FLY_CUSTOM_SPELL_05 = 446, + ANIM_FLY_CUSTOM_SPELL_06 = 447, + ANIM_FLY_CUSTOM_SPELL_07 = 448, + ANIM_FLY_CUSTOM_SPELL_08 = 449, + ANIM_FLY_CUSTOM_SPELL_09 = 450, + ANIM_FLY_CUSTOM_SPELL_10 = 451, + ANIM_FLY_STEALTH_RUN = 452, + ANIM_FLY_EMERGE = 453, + ANIM_FLY_COWER = 454, + ANIM_FLY_GRAB = 455, + ANIM_FLY_GRAB_CLOSED = 456, + ANIM_FLY_GRAB_THROWN = 457, + ANIM_TO_FLY = 458, + ANIM_TO_HOVER = 459, + ANIM_TO_GROUND = 460, + ANIM_FLY_TO_FLY = 461, + ANIM_FLY_TO_HOVER = 462, + ANIM_FLY_TO_GROUND = 463, + ANIM_SETTLE = 464, + ANIM_FLY_SETTLE = 465, + ANIM_DEATH_START = 466, + ANIM_DEATH_LOOP = 467, + ANIM_DEATH_END = 468, + ANIM_FLY_DEATH_START = 469, + ANIM_FLY_DEATH_LOOP = 470, + ANIM_FLY_DEATH_END = 471, + ANIM_DEATH_END_HOLD = 472, + ANIM_FLY_DEATH_END_HOLD = 473, + ANIM_STRANGULATE = 474, + ANIM_FLY_STRANGULATE = 475, + ANIM_READY_JOUST = 476, + ANIM_LOAD_JOUST = 477, + ANIM_HOLD_JOUST = 478, + ANIM_FLY_READY_JOUST = 479, + ANIM_FLY_LOAD_JOUST = 480, + ANIM_FLY_HOLD_JOUST = 481, + ANIM_ATTACK_JOUST = 482, + ANIM_FLY_ATTACK_JOUST = 483, + ANIM_RECLINED_MOUNT = 484, + ANIM_FLY_RECLINED_MOUNT = 485, + ANIM_TO_ALTERED = 486, + ANIM_FROM_ALTERED = 487, + ANIM_FLY_TO_ALTERED = 488, + ANIM_FLY_FROM_ALTERED = 489, + ANIM_IN_STOCKS = 490, + ANIM_FLY_IN_STOCKS = 491, + ANIM_VEHICLE_GRAB = 492, + ANIM_VEHICLE_THROW = 493, + ANIM_FLY_VEHICLE_GRAB = 494, + ANIM_FLY_VEHICLE_THROW = 495, + ANIM_TO_ALTERED_POST_SWAP = 496, + ANIM_FROM_ALTERED_POST_SWAP = 497, + ANIM_FLY_TO_ALTERED_POST_SWAP = 498, + ANIM_FLY_FROM_ALTERED_POST_SWAP = 499, + ANIM_RECLINED_MOUNT_PASSENGER = 500, + ANIM_FLY_RECLINED_MOUNT_PASSENGER = 501, + ANIM_CARRY2H = 502, + ANIM_CARRIED2H = 503, + ANIM_FLY_CARRY2H = 504, + ANIM_FLY_CARRIED2H = 505 }; enum LockKeyType @@ -2473,8 +2760,8 @@ enum SkillType SKILL_SURVIVAL2 = 142, SKILL_RIDING_HORSE = 148, SKILL_RIDING_WOLF = 149, - SKILL_RIDING_RAM = 152, SKILL_RIDING_TIGER = 150, + SKILL_RIDING_RAM = 152, SKILL_SWIMING = 155, SKILL_2H_MACES = 160, SKILL_UNARMED = 162, diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp index 8eff3e3a042..17cf775603f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp @@ -1238,10 +1238,10 @@ public: me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); break; case 2: - me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); + me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK_UNARMED); break; case 3: - me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); + me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK_UNARMED); break; case 4: me->HandleEmoteCommand(EMOTE_ONESHOT_KICK); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp index febe89772fd..9512d66b6eb 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/the_scarlet_enclave.cpp @@ -91,7 +91,7 @@ public: case 2: if (!player->isRessurectRequested()) { - me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOMSPELL01); + me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_01); DoCast(player, SPELL_REVIVE, true); me->MonsterWhisper(VALK_WHISPER, player->GetGUID()); } diff --git a/src/server/scripts/EasternKingdoms/westfall.cpp b/src/server/scripts/EasternKingdoms/westfall.cpp index 34cc8559a71..271e1d99d63 100644 --- a/src/server/scripts/EasternKingdoms/westfall.cpp +++ b/src/server/scripts/EasternKingdoms/westfall.cpp @@ -110,7 +110,7 @@ public: case 4: SetEquipmentSlots(false, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE, EQUIP_ID_RIFLE); me->SetSheath(SHEATH_STATE_RANGED); - me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE); + me->HandleEmoteCommand(EMOTE_STATE_USE_STANDING_NO_SHEATHE); break; case 7: me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836f, 1569.755f, 54.267f, 4.230f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); @@ -141,7 +141,7 @@ public: case 13: SetEquipmentSlots(true); me->SetSheath(SHEATH_STATE_UNARMED); - me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE); + me->HandleEmoteCommand(EMOTE_STATE_USE_STANDING_NO_SHEATHE); break; case 17: player->GroupEventHappens(QUEST_TOME_VALOR, me); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index 6466780f024..65bc8f6a8e6 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -678,7 +678,7 @@ public: } if (i == LastOverronPos && IsOverrun) { - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACKUNARMED); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACK_UNARMED); if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21)) { me->setDeathState(DEAD); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp index d56608ba7f1..7f3c19ac69c 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp @@ -38,7 +38,7 @@ EndScriptData */ #define SPELL_ARCANE_EXPLOSION 25679 #define SPELL_EARTH_SHOCK 26194 -#define SPELL_TRUE_FULFILLMENT4 26526 +#define SPELL_TRUE_FULFILLMENT 785 #define SPELL_BLINK 28391 class ov_mycoordinates diff --git a/src/server/scripts/Kalimdor/durotar.cpp b/src/server/scripts/Kalimdor/durotar.cpp index 8cf72b3538d..6c91c64f981 100644 --- a/src/server/scripts/Kalimdor/durotar.cpp +++ b/src/server/scripts/Kalimdor/durotar.cpp @@ -84,7 +84,7 @@ public: void UpdateAI(const uint32 uiDiff) { if (work == true) - me->HandleEmoteCommand(466); + me->HandleEmoteCommand(EMOTE_ONESHOT_WORK_CHOPWOOD); if (m_uiRebuffTimer <= uiDiff) { DoCast(me, SPELL_BUFF_SLEEP); diff --git a/src/server/scripts/Kalimdor/mulgore.cpp b/src/server/scripts/Kalimdor/mulgore.cpp index 01cca58359e..c689d6954a4 100644 --- a/src/server/scripts/Kalimdor/mulgore.cpp +++ b/src/server/scripts/Kalimdor/mulgore.cpp @@ -171,7 +171,7 @@ public: break; case 2: DoScriptText(EMOTE_EAT_LUNCH, me); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USESTANDING); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING); break; case 3: if (Player* unit = Unit::GetPlayer(*me, uiPlayerGUID)) diff --git a/src/server/scripts/Kalimdor/the_barrens.cpp b/src/server/scripts/Kalimdor/the_barrens.cpp index 6f2ddb1febb..e12897c1def 100644 --- a/src/server/scripts/Kalimdor/the_barrens.cpp +++ b/src/server/scripts/Kalimdor/the_barrens.cpp @@ -512,7 +512,7 @@ public: //creature->GetMotionMaster()->MovePoint(0, -1693, -4343, 4.32f); //creature->GetMotionMaster()->MovePoint(1, -1684, -4333, 2.78f); creature->GetMotionMaster()->MovePoint(2, -1682, -4329, 2.79f); - creature->HandleEmoteCommand(EMOTE_STATE_READYUNARMED); + creature->HandleEmoteCommand(EMOTE_STATE_READY_UNARMED); EventBigWill = true; Wave_Timer = 1000; } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index b17b6f1286b..3831e4824ad 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -429,7 +429,7 @@ class npc_fizzlebang_toc : public CreatureScript case 1130: me->GetMotionMaster()->MovementExpired(); DoScriptText(SAY_STAGE_1_03, me); - me->HandleEmoteCommand(EMOTE_ONESHOT_SPELLCAST_OMNI); + me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST_OMNI); if (Unit* pTrigger = me->SummonCreature(NPC_TRIGGER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 4.69494f, TEMPSUMMON_MANUAL_DESPAWN)) { m_uiTriggerGUID = pTrigger->GetGUID(); @@ -446,7 +446,7 @@ class npc_fizzlebang_toc : public CreatureScript m_uiUpdateTimer = 4000; break; case 1134: - me->HandleEmoteCommand(EMOTE_ONESHOT_SPELLCAST_OMNI); + me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST_OMNI); if (Creature* pPortal = me->SummonCreature(NPC_WILFRED_PORTAL, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 4.71239f, TEMPSUMMON_MANUAL_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 9866d2aace0..2acd014e063 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -883,7 +883,7 @@ class boss_the_lich_king : public CreatureScript case EVENT_INTRO_TALK_1: Talk(SAY_LK_INTRO_2); // for some reason blizz sends 2 emotes in row here so (we handle one in Talk) - me->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NOSHEATHE); + me->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NO_SHEATHE); events.ScheduleEvent(EVENT_EMOTE_CAST_SHOUT, 7000, 0, PHASE_INTRO); events.ScheduleEvent(EVENT_INTRO_EMOTE_1, 13000, 0, PHASE_INTRO); events.ScheduleEvent(EVENT_EMOTE_CAST_SHOUT, 18000, 0, PHASE_INTRO); @@ -893,7 +893,7 @@ class boss_the_lich_king : public CreatureScript DoCast(me, SPELL_EMOTE_SHOUT_NO_SHEATH, false); break; case EVENT_INTRO_EMOTE_1: - me->HandleEmoteCommand(EMOTE_ONESHOT_POINT_NOSHEATHE); + me->HandleEmoteCommand(EMOTE_ONESHOT_POINT_NO_SHEATHE); break; case EVENT_INTRO_CAST_FREEZE: Talk(SAY_LK_INTRO_3); @@ -1043,7 +1043,7 @@ class boss_the_lich_king : public CreatureScript DoCastAOE(SPELL_EMOTE_QUESTION_NO_SHEATH); break; case EVENT_OUTRO_EMOTE_TALK: - me->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NOSHEATHE); + me->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NO_SHEATHE); break; case EVENT_OUTRO_TALK_3: if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) @@ -1268,7 +1268,7 @@ class npc_tirion_fordring_tft : public CreatureScript _events.ScheduleEvent(EVENT_INTRO_CHARGE, 5000, 0, PHASE_INTRO); break; case EVENT_INTRO_EMOTE_1: - me->HandleEmoteCommand(EMOTE_ONESHOT_POINT_NOSHEATHE); + me->HandleEmoteCommand(EMOTE_ONESHOT_POINT_NO_SHEATHE); break; case EVENT_INTRO_CHARGE: me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index d02d8f3f316..00a6a02f2da 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -477,7 +477,7 @@ class npc_highlord_tirion_fordring_lh : public CreatureScript Talk(SAY_TIRION_INTRO_3); break; case EVENT_LK_INTRO_1: - me->HandleEmoteCommand(EMOTE_ONESHOT_POINT_NOSHEATHE); + me->HandleEmoteCommand(EMOTE_ONESHOT_POINT_NO_SHEATHE); if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _theLichKing)) theLichKing->AI()->Talk(SAY_LK_INTRO_1); break; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 26e4b33ad8a..8c6afba18fd 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -354,7 +354,7 @@ class boss_gothik : public CreatureScript } if (spellId && me->isInCombat()) { - me->HandleEmoteCommand(EMOTE_ONESHOT_SPELLCAST); + me->HandleEmoteCommand(EMOTE_ONESHOT_SPELL_CAST); if (Creature* pRandomDeadTrigger = Unit::GetCreature(*me, DeadTriggerGUID[rand() % POS_DEAD])) me->CastSpell(pRandomDeadTrigger, spellId, true); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index 6b170bab6d8..45f9a1fa012 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -668,7 +668,7 @@ class npc_expedition_commander : public CreatureScript break; case 4: for (uint8 n = 0; n < RAID_MODE(2, 4); n++) - Engineer[n]->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USESTANDING); + Engineer[n]->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING); for (uint8 n = 0; n < 4; ++n) Defender[n]->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); me->MonsterYell(SAY_AGGRO_2, LANG_UNIVERSAL, 0); diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp index c0fad2374bc..ccb31c869a4 100644 --- a/src/server/scripts/Northrend/grizzly_hills.cpp +++ b/src/server/scripts/Northrend/grizzly_hills.cpp @@ -415,7 +415,7 @@ public: // call this each update tick? if (me->FindNearestCreature(TALLHORN_STAG, 0.2f)) { - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USESTANDING); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USE_STANDING); } else if (m_uiPhase) diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp index 07de7fe4786..19c4754c4fd 100644 --- a/src/server/scripts/Outland/shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/shadowmoon_valley.cpp @@ -117,7 +117,7 @@ public: { bIsEating = true; EatTimer = 7000; - me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED); + me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK_UNARMED); } } -- cgit v1.2.3 From 9e3b81c0ef56bd51b1559fe0afdb280b86ad51ca Mon Sep 17 00:00:00 2001 From: Nay Date: Tue, 7 Feb 2012 16:39:08 +0000 Subject: Scripts&DB: Scripts and spawns for quest The Lifewarden's Wrath Closes #5120 --- sql/updates/world/2012_02_07_00_world_misc.sql | 60 ++++++++++++++++++ src/server/scripts/Northrend/sholazar_basin.cpp | 81 +++++++++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 sql/updates/world/2012_02_07_00_world_misc.sql (limited to 'src/server/scripts/Northrend') diff --git a/sql/updates/world/2012_02_07_00_world_misc.sql b/sql/updates/world/2012_02_07_00_world_misc.sql new file mode 100644 index 00000000000..ef34c56ed00 --- /dev/null +++ b/sql/updates/world/2012_02_07_00_world_misc.sql @@ -0,0 +1,60 @@ +DELETE FROM `creature` WHERE `id` IN (28538,29056,28563); +DELETE FROM `creature` WHERE `id`=28320 AND `guid` BETWEEN 40451 AND 40462 OR `guid` IN (40466,40467); +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`,`npcflag`,`unit_flags`,`dynamicflags`) VALUES +-- Cultist Saboteur +(40271,28538,571,1,1,0,0,6197.03,4772.67,221.593,4.62512,120,0,0,1,0,0,0,0,0), +(40272,28538,571,1,1,0,0,6207.94,4791.03,224.951,0.504098,120,0,0,1,0,0,0,0,0), +(40273,28538,571,1,1,0,0,6209.31,4766.71,224.144,3.22886,120,0,0,1,0,0,0,0,0), +(40274,28538,571,1,1,0,0,6177.88,4737.93,224.747,2.24767,120,0,0,1,0,0,0,0,0), +(40275,28538,571,1,1,0,0,6185.42,4760.61,224.796,1.62316,120,0,0,1,0,0,0,0,0), +(40276,28538,571,1,1,0,0,6195.94,4761.25,220.873,1.53589,120,0,0,1,0,0,0,0,0), +(40277,28538,571,1,1,0,0,6231.93,4739.39,224.738,5.95606,120,0,0,1,0,0,0,0,0), +(40278,28538,571,1,1,0,0,6208.1,4762.39,222.758,2.87979,120,0,0,1,0,0,0,0,0), +-- Servant of Freya +(40451,28320,571,1,1,0,0,6177.58,4762.69,225.418,1.78024,120,0,0,1,0,0,0,0,0), +(40452,28320,571,1,1,0,0,6236,4785.33,224.865,1.90241,120,0,0,1,0,0,0,0,0), +(40453,28320,571,1,1,0,0,6218.78,4772.22,224.84,5.41052,120,0,0,1,0,0,0,0,0), +(40454,28320,571,1,1,0,0,6191.46,4728.85,224.807,5.86431,120,0,0,1,0,0,0,0,0), +(40455,28320,571,1,1,0,0,6206.62,4787.49,224.797,4.64258,120,0,0,1,0,0,0,0,0), +(40456,28320,571,1,1,0,0,6185.58,4761.77,224.796,4.39823,120,0,0,1,0,0,0,0,0), +(40457,28320,571,1,1,0,0,6226.41,4738,224.796,5.61996,120,0,0,1,0,0,0,0,0), +(40458,28320,571,1,1,0,0,6206.94,4750.79,224.796,3.78736,120,0,0,1,0,0,0,0,0), +(40459,28320,571,1,1,0,0,6238.17,4731.89,224.783,3.92699,120,0,0,1,0,0,0,0,0), +(40460,28320,571,1,1,0,0,6177.83,4730.03,224.693,0.244346,120,0,0,1,0,0,0,0,0), +(40461,28320,571,1,1,0,0,6168.2,4749.64,224.577,5.0091,120,0,0,1,0,0,0,0,0), +(40462,28320,571,1,1,0,0,6242.58,4769.51,224.443,2.98451,120,0,0,1,0,0,0,0,0), +(40466,28320,571,1,1,0,0,6217.79,4796.46,224.431,1.39626,120,0,0,1,0,0,0,0,0), +(40467,28320,571,1,1,0,0,6254.19,4757.5,217.856,0.837758,120,0,0,1,0,0,0,0,0), +-- Glimmering Pillar Credit +(40468,29056,571,1,1,0,0,6201.76,4764.45,225.84,3.19395,120,0,0,1,0,0,0,0,0), +-- Freya's Presence +(40469,28563,571,1,1,0,0,6203.26,4765.47,248.057,1.95477,120,0,0,1,0,0,0,0,0); + +-- by Valcorb +DELETE FROM `gameobject` WHERE `id`=300223; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(227,300223,571,1,1,6204.758301,4766.002930,221.531799,0,0,0,0,0,300,0,1); + +UPDATE `creature_template` SET `unit_flags`=0,`MovementType`=1 WHERE `entry`=28320; -- Servant of Freya +UPDATE `creature_template` SET `MovementType`=1 WHERE `entry`=28538; -- Cultist Saboteur +UPDATE `creature_template` SET `exp`=0,`InhabitType`=7,`flags_extra`=`flags_extra`|128 WHERE `entry`=28563; -- Freya's Presence + +DELETE FROM `creature_template_addon` WHERE `entry` IN (28538,29036,28320,28563); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(28538,0,0,1,69, NULL), -- Cultist Saboteur (EMOTE_STATE_USE_STANDING) +(29036,0,0,1,0, '52948 61750 61751'), -- Servant of Freya (All Wild Growth, visual effects) +(28320,0,0,1,429, NULL), -- Servant of Freya +(28563,0,0,1,0, NULL); -- Freya's Presence + +DELETE FROM `creature_text` WHERE `entry`=28563; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(28563,0,0, 'The structure above begins to hum with energy.',42,0,0,0,0,0, 'Freya''s Presence - On Call of the Lifewarden cast'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (51318,51395); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,51318,0,0,18,1,28320,0,0, '', 'Freya Dummy - Target Servant of Freya'), +(13,0,51395,0,0,18,1,28538,0,0, '', 'Lifeforce - Target Cultist Saboteur'); + +DELETE FROM `spell_script_names` WHERE `spell_id`=51957; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(51957,'spell_q12620_the_lifewarden_wrath'); diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index c7153eb4006..387c671edc8 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -665,6 +665,86 @@ public: } }; +/*###### +## Quest The Lifewarden's Wrath +######*/ + +enum Misc +{ + NPC_PRESENCE = 28563, // Freya's Presence + NPC_SABOTEUR = 28538, // Cultist Saboteur + NPC_SERVANT = 28320, // Servant of Freya + + WHISPER_ACTIVATE = 0, + + SPELL_FREYA_DUMMY = 51318, + SPELL_LIFEFORCE = 51395, + SPELL_FREYA_DUMMY_TRIGGER = 51335, + SPELL_LASHER_EMERGE = 48195, + SPELL_WILD_GROWTH = 52948, +}; + +class spell_q12620_the_lifewarden_wrath : public SpellScriptLoader +{ +public: + spell_q12620_the_lifewarden_wrath() : SpellScriptLoader("spell_q12620_the_lifewarden_wrath") { } + + class spell_q12620_the_lifewarden_wrath_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12620_the_lifewarden_wrath_SpellScript); + + void HandleSendEvent(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + + if (Unit* caster = GetCaster()) + { + if (Creature* presence = caster->FindNearestCreature(NPC_PRESENCE, 50.0f)) + { + presence->AI()->Talk(WHISPER_ACTIVATE, caster->GetGUID()); + presence->CastSpell(presence, SPELL_FREYA_DUMMY, true); // will target plants + // Freya Dummy could be scripted with the following code + + // Revive plants + std::list servants; + GetCaster()->GetCreatureListWithEntryInGrid(servants, NPC_SERVANT, 200.0f); + for (std::list::iterator itr = servants.begin(); itr != servants.end(); ++itr) + { + // Couldn't find a spell that does this + if ((*itr)->isDead()) + (*itr)->Respawn(true); + + (*itr)->CastSpell(*itr, SPELL_FREYA_DUMMY_TRIGGER, true); + (*itr)->CastSpell(*itr, SPELL_LASHER_EMERGE, false); + (*itr)->CastSpell(*itr, SPELL_WILD_GROWTH, false); + + if (Unit* target = (*itr)->SelectNearestTarget(150.0f)) + (*itr)->AI()->AttackStart(target); + } + + // Kill nearby enemies + std::list saboteurs; + caster->GetCreatureListWithEntryInGrid(saboteurs, NPC_SABOTEUR, 200.0f); + for (std::list::iterator itr = saboteurs.begin(); itr != saboteurs.end(); ++itr) + if ((*itr)->isAlive()) + // Lifeforce has a cast duration, it should be cast at all saboteurs one by one + presence->CastSpell((*itr), SPELL_LIFEFORCE, false); + } + } + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_q12620_the_lifewarden_wrath_SpellScript::HandleSendEvent, EFFECT_0, SPELL_EFFECT_SEND_EVENT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_q12620_the_lifewarden_wrath_SpellScript(); + } +}; + void AddSC_sholazar_basin() { new npc_injured_rainspeaker_oracle(); @@ -674,4 +754,5 @@ void AddSC_sholazar_basin() new npc_engineer_helice(); new npc_adventurous_dwarf(); new npc_jungle_punch_target(); + new spell_q12620_the_lifewarden_wrath(); } -- cgit v1.2.3 From 32b2fccf331e545b83e8e584a0eb4804539173c4 Mon Sep 17 00:00:00 2001 From: Nay Date: Wed, 8 Feb 2012 03:06:53 +0000 Subject: Scripts/Misc: Script Romantic Picnic Basket - Fix achievement "Lonely?" - Added spell_holiday.cpp for spells related with holidays scripts - Closes #5116 :heart: --- sql/updates/world/2011_02_08_00_world_misc.sql | 20 +++++ src/server/game/Scripting/ScriptLoader.cpp | 2 + src/server/scripts/Northrend/sholazar_basin.cpp | 2 +- src/server/scripts/Spells/CMakeLists.txt | 1 + src/server/scripts/Spells/spell_holiday.cpp | 110 ++++++++++++++++++++++++ 5 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 sql/updates/world/2011_02_08_00_world_misc.sql create mode 100644 src/server/scripts/Spells/spell_holiday.cpp (limited to 'src/server/scripts/Northrend') diff --git a/sql/updates/world/2011_02_08_00_world_misc.sql b/sql/updates/world/2011_02_08_00_world_misc.sql new file mode 100644 index 00000000000..40ce5629214 --- /dev/null +++ b/sql/updates/world/2011_02_08_00_world_misc.sql @@ -0,0 +1,20 @@ +UPDATE `gameobject_template` SET `flags` = `flags` | 32, `AIName` = 'SmartGameObjectAI' WHERE `entry` = 187267; + +DELETE FROM `spell_script_names` WHERE `spell_id` = 45102; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(45102, 'spell_love_is_in_the_air_romantic_picnic'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 13 AND `SourceEntry` IN (45119, 45103, 45114); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 0, 45119, 0, 0, 18, 0, 187267, 0, 0, '', 'Holiday - Valentine - Romantic Picnic Near Basket Check - Target Romantic Basket'), +(13, 0, 45103, 0, 0, 18, 1, 0, 0, 0, '', 'Holiday - Valentine - Romantic Picnic Meal Periodic - Target Players'), +(13, 0, 45114, 0, 0, 18, 1, 0, 0, 0, '', 'Holiday - Valentine - Romantic Picnic Meal Particle - Target Players'); + +DELETE FROM `smart_scripts` WHERE `entryorguid`=187267 AND `source_type`=1; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(187267, 1, 0, 0, 60, 0, 100, 0, 3*60*1000, 3*60*1000, 0, 0, 99, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Picnic Basket - Despawn after 3 minutes'); + +DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (1291,5787,4071); +INSERT INTO `achievement_criteria_data` (`criteria_id`, `type`, `value1`, `value2`, `ScriptName`) VALUES +(5787, 6, 4395, 0, ''), -- Lonely? - Dalaran +(4071, 6, 4395, 0, ''); -- Lonely? - Dalaran diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index c46721db6cd..cdec6bb3ffa 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -39,6 +39,7 @@ void AddSC_warrior_spell_scripts(); void AddSC_quest_spell_scripts(); void AddSC_item_spell_scripts(); void AddSC_example_spell_scripts(); +void AddSC_holiday_spell_scripts(); void AddSC_SmartSCripts(); @@ -642,6 +643,7 @@ void AddSpellScripts() AddSC_quest_spell_scripts(); AddSC_item_spell_scripts(); AddSC_example_spell_scripts(); + AddSC_holiday_spell_scripts(); } void AddCommandScripts() diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index 387c671edc8..40e1051f218 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -669,7 +669,7 @@ public: ## Quest The Lifewarden's Wrath ######*/ -enum Misc +enum MiscLifewarden { NPC_PRESENCE = 28563, // Freya's Presence NPC_SABOTEUR = 28538, // Cultist Saboteur diff --git a/src/server/scripts/Spells/CMakeLists.txt b/src/server/scripts/Spells/CMakeLists.txt index 0df7cf907b6..496324e4de9 100644 --- a/src/server/scripts/Spells/CMakeLists.txt +++ b/src/server/scripts/Spells/CMakeLists.txt @@ -23,6 +23,7 @@ set(scripts_STAT_SRCS Spells/spell_mage.cpp Spells/spell_paladin.cpp Spells/spell_item.cpp + Spells/spell_holiday.cpp ) message(" -> Prepared: Spells") diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp new file mode 100644 index 00000000000..19b6a29e24b --- /dev/null +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +/* + * Spells used in holidays/game events that do not fit any other category. + * Scriptnames in this file should be prefixed with "spell_#holidayname_". + */ + +#include "ScriptPCH.h" + +// 45102 Romantic Picnic + +enum SpellsPicnic +{ + SPELL_BASKET_CHECK = 45119, // Holiday - Valentine - Romantic Picnic Near Basket Check + SPELL_MEAL_PERIODIC = 45103, // Holiday - Valentine - Romantic Picnic Meal Periodic - effect dummy + SPELL_MEAL_EAT_VISUAL = 45120, // Holiday - Valentine - Romantic Picnic Meal Eat Visual + // SPELL_MEAL_PARTICLE = 45114, // Holiday - Valentine - Romantic Picnic Meal Particle - unused + SPELL_DRINK_VISUAL = 45121, // Holiday - Valentine - Romantic Picnic Drink Visual + SPELL_ROMANTIC_PICNIC_ACHIEV = 45123, // Romantic Picnic periodic = 5000 +}; + +class spell_love_is_in_the_air_romantic_picnic : public SpellScriptLoader +{ +public: + spell_love_is_in_the_air_romantic_picnic() : SpellScriptLoader("spell_love_is_in_the_air_romantic_picnic") { } + + class spell_love_is_in_the_air_romantic_picnic_AuraScript : public AuraScript + { + PrepareAuraScript(spell_love_is_in_the_air_romantic_picnic_AuraScript); + + void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + if (Unit* target = GetTarget()) + { + target->SetStandState(UNIT_STAND_STATE_SIT); + target->CastSpell(target, SPELL_MEAL_PERIODIC, false); + } + } + + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + // Every 5 seconds + if (Unit* target = GetTarget()) + { + // If our player is no longer sit, remove all auras + if (target->getStandState() != UNIT_STAND_STATE_SIT) + { + target->RemoveAura(SPELL_ROMANTIC_PICNIC_ACHIEV); + target->RemoveAura(GetAura()); + return; + } + + target->CastSpell(target, SPELL_BASKET_CHECK, false); // unknown use, it targets Romantic Basket + target->CastSpell(target, RAND(SPELL_MEAL_EAT_VISUAL, SPELL_DRINK_VISUAL), false); + + bool foundSomeone = false; + // For nearby players, check if they have the same aura. If so, cast Romantic Picnic (45123) + // required by achievement and "hearts" visual + std::list playerList; + Trinity::AnyPlayerInObjectRangeCheck checker(target, INTERACTION_DISTANCE*2); + Trinity::PlayerListSearcher searcher(target, playerList, checker); + target->VisitNearbyWorldObject(INTERACTION_DISTANCE*2, searcher); + for (std::list::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) + { + if ((*itr) != target && (*itr)->HasAura(GetId())) // && (*itr)->getStandState() == UNIT_STAND_STATE_SIT) + { + GetCaster()->CastSpell(*itr, SPELL_ROMANTIC_PICNIC_ACHIEV, true); + GetCaster()->CastSpell(target, SPELL_ROMANTIC_PICNIC_ACHIEV, true); + foundSomeone = true; + // break; + } + } + + if (!foundSomeone && target->HasAura(SPELL_ROMANTIC_PICNIC_ACHIEV)) + target->RemoveAura(SPELL_ROMANTIC_PICNIC_ACHIEV); + } + } + + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_love_is_in_the_air_romantic_picnic_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_love_is_in_the_air_romantic_picnic_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_love_is_in_the_air_romantic_picnic_AuraScript(); + } +}; + +void AddSC_holiday_spell_scripts() +{ + new spell_love_is_in_the_air_romantic_picnic(); +} -- cgit v1.2.3 From 201af95af3614e3c44afda4a11dfd21a7e0937d6 Mon Sep 17 00:00:00 2001 From: glkrlos Date: Wed, 8 Feb 2012 18:25:58 -0600 Subject: From beginning of Sartharion encounter if Tenebron, Shadron and/or Vesperon are alive the Spell Power of Tenebron, Shadron and/or Vesperon must be casted on all players, this occurs like retail. --- .../Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index d01e2663b12..3e9d8144c19 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -427,6 +427,7 @@ public: bCanUseWill = true; if (!pFetchTene->isInCombat()) { + DoCast(me, SPELL_POWER_OF_TENEBRON); AddDrakeLootMode(); ++drakeCount; } @@ -441,6 +442,7 @@ public: bCanUseWill = true; if (!pFetchShad->isInCombat()) { + DoCast(me, SPELL_POWER_OF_SHADRON); AddDrakeLootMode(); ++drakeCount; } @@ -455,6 +457,7 @@ public: bCanUseWill = true; if (!pFetchVesp->isInCombat()) { + DoCast(me, SPELL_POWER_OF_VESPERON); AddDrakeLootMode(); ++drakeCount; } @@ -1017,7 +1020,6 @@ public: { DoScriptText(SAY_TENEBRON_AGGRO, me); DoZoneInCombat(); - DoCast(me, SPELL_POWER_OF_TENEBRON); } void KilledUnit(Unit* /*victim*/) @@ -1113,7 +1115,6 @@ public: { DoScriptText(SAY_SHADRON_AGGRO, me); DoZoneInCombat(); - DoCast(me, SPELL_POWER_OF_SHADRON); } void KilledUnit(Unit* /*victim*/) @@ -1212,7 +1213,6 @@ public: { DoScriptText(SAY_VESPERON_AGGRO, me); DoZoneInCombat(); - DoCast(me, SPELL_POWER_OF_VESPERON); } void KilledUnit(Unit* /*victim*/) -- cgit v1.2.3 From 93d199f04382fe3c7f6f08f59fd2ad058568679a Mon Sep 17 00:00:00 2001 From: Subv2112 Date: Fri, 3 Feb 2012 16:03:52 -0500 Subject: Core/Collision: Ported dynamic line of sight patch by Silverice from MaNGOS and added lots of improvements Please re-extract vmaps --- src/server/authserver/Server/RealmSocket.h | 1 + src/server/collision/BoundingIntervalHierarchy.h | 22 +- .../collision/BoundingIntervalHierarchyWrapper.h | 109 ++++++ src/server/collision/CMakeLists.txt | 27 ++ src/server/collision/DynamicTree.cpp | 206 +++++++++++ src/server/collision/DynamicTree.h | 60 ++++ src/server/collision/Maps/TileAssembler.cpp | 388 +++++++++++---------- src/server/collision/Maps/TileAssembler.h | 29 ++ src/server/collision/Models/GameObjectModel.cpp | 175 ++++++++++ src/server/collision/Models/GameObjectModel.h | 69 ++++ src/server/collision/Models/WorldModel.h | 2 +- src/server/collision/RegularGrid.h | 218 ++++++++++++ src/server/collision/VMapDefinitions.h | 4 +- .../game/Battlegrounds/Zones/BattlegroundDS.cpp | 12 +- .../game/Battlegrounds/Zones/BattlegroundDS.h | 4 +- .../game/Battlegrounds/Zones/BattlegroundRV.cpp | 28 +- .../game/Battlegrounds/Zones/BattlegroundRV.h | 9 +- src/server/game/CMakeLists.txt | 2 + src/server/game/DataStores/DBCStructure.h | 2 +- src/server/game/DataStores/DBCfmt.h | 2 +- src/server/game/Entities/Creature/Creature.cpp | 2 +- src/server/game/Entities/GameObject/GameObject.cpp | 104 +++++- src/server/game/Entities/GameObject/GameObject.h | 10 +- src/server/game/Entities/Object/Object.cpp | 29 +- src/server/game/Entities/Transport/Transport.cpp | 2 +- src/server/game/Handlers/QueryHandler.cpp | 2 +- src/server/game/Maps/Map.cpp | 16 +- src/server/game/Maps/Map.h | 10 +- src/server/game/Movement/MotionMaster.cpp | 4 +- .../FleeingMovementGenerator.cpp | 6 +- .../MovementGenerators/RandomMovementGenerator.cpp | 8 +- src/server/game/Spells/Spell.cpp | 2 +- src/server/game/World/World.cpp | 5 + src/server/scripts/CMakeLists.txt | 2 + src/server/scripts/Commands/cs_debug.cpp | 8 + src/server/scripts/Commands/cs_gps.cpp | 4 +- .../BattleForMountHyjal/hyjal_trash.cpp | 4 +- .../IcecrownCitadel/boss_blood_prince_council.cpp | 4 +- .../IcecrownCitadel/boss_professor_putricide.cpp | 2 +- .../IcecrownCitadel/boss_the_lich_king.cpp | 2 +- .../Northrend/IcecrownCitadel/icecrown_citadel.cpp | 2 +- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 2 +- .../Outland/BlackTemple/boss_teron_gorefiend.cpp | 2 +- src/server/worldserver/CMakeLists.txt | 2 + src/tools/vmap3_assembler/CMakeLists.txt | 1 + src/tools/vmap3_extractor/adtfile.cpp | 69 ++-- src/tools/vmap3_extractor/adtfile.h | 22 ++ src/tools/vmap3_extractor/dbcfile.cpp | 18 + src/tools/vmap3_extractor/dbcfile.h | 24 +- src/tools/vmap3_extractor/gameobject_extract.cpp | 99 ++++++ src/tools/vmap3_extractor/loadlib/loadlib.h | 20 +- src/tools/vmap3_extractor/model.cpp | 38 +- src/tools/vmap3_extractor/model.h | 29 +- src/tools/vmap3_extractor/modelheaders.h | 18 + src/tools/vmap3_extractor/mpq_libmpq04.h | 13 +- src/tools/vmap3_extractor/vmapexport.cpp | 236 +++++++------ src/tools/vmap3_extractor/vmapexport.h | 33 +- src/tools/vmap3_extractor/wdtfile.cpp | 18 + src/tools/vmap3_extractor/wmo.cpp | 20 +- src/tools/vmap3_extractor/wmo.h | 18 + 60 files changed, 1849 insertions(+), 430 deletions(-) create mode 100644 src/server/collision/BoundingIntervalHierarchyWrapper.h create mode 100644 src/server/collision/DynamicTree.cpp create mode 100644 src/server/collision/DynamicTree.h create mode 100644 src/server/collision/Models/GameObjectModel.cpp create mode 100644 src/server/collision/Models/GameObjectModel.h create mode 100644 src/server/collision/RegularGrid.h create mode 100644 src/tools/vmap3_extractor/gameobject_extract.cpp (limited to 'src/server/scripts/Northrend') diff --git a/src/server/authserver/Server/RealmSocket.h b/src/server/authserver/Server/RealmSocket.h index 9682b5e4559..9dbd0a4aafb 100755 --- a/src/server/authserver/Server/RealmSocket.h +++ b/src/server/authserver/Server/RealmSocket.h @@ -24,6 +24,7 @@ #include #include #include +#include "Common.h" class RealmSocket : public ACE_Svc_Handler { diff --git a/src/server/collision/BoundingIntervalHierarchy.h b/src/server/collision/BoundingIntervalHierarchy.h index b0c35237a9d..ea70fc3e322 100755 --- a/src/server/collision/BoundingIntervalHierarchy.h +++ b/src/server/collision/BoundingIntervalHierarchy.h @@ -81,13 +81,25 @@ struct AABound class BIH { + private: + void init_empty() + { + tree.clear(); + objects.clear(); + // create space for the first node + tree.push_back(3 << 30); // dummy leaf + tree.insert(tree.end(), 2, 0); + } public: - BIH() {}; - template< class T, class BoundsFunc > - void build(const std::vector &primitives, BoundsFunc &getBounds, uint32 leafSize = 3, bool printStats=false) + BIH() { init_empty(); } + template< class BoundsFunc, class PrimArray > + void build(const PrimArray &primitives, BoundsFunc &getBounds, uint32 leafSize = 3, bool printStats=false) { - if (primitives.empty()) + if (primitives.size() == 0) + { + init_empty(); return; + } buildData dat; dat.maxPrims = leafSize; @@ -397,4 +409,4 @@ class BIH void subdivide(int left, int right, std::vector &tempTree, buildData &dat, AABound &gridBox, AABound &nodeBox, int nodeIndex, int depth, BuildStats &stats); }; -#endif // _BIH_H +#endif // _BIH_H \ No newline at end of file diff --git a/src/server/collision/BoundingIntervalHierarchyWrapper.h b/src/server/collision/BoundingIntervalHierarchyWrapper.h new file mode 100644 index 00000000000..e54a4e653a1 --- /dev/null +++ b/src/server/collision/BoundingIntervalHierarchyWrapper.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * Copyright (C) 2005-2010 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef _BIH_WRAP +#define _BIH_WRAP + +#include "G3D/Table.h" +#include "G3D/Array.h" +#include "G3D/Set.h" +#include "BoundingIntervalHierarchy.h" + + +template > +class BIHWrap +{ + template + struct MDLCallback + { + const T* const* objects; + RayCallback& _callback; + + MDLCallback(RayCallback& callback, const T* const* objects_array ) : _callback(callback), objects(objects_array){} + + bool operator() (const Ray& ray, uint32 Idx, float& MaxDist, bool /*stopAtFirst*/) + { + if (const T* obj = objects[Idx]) + return _callback(ray, *obj, MaxDist/*, stopAtFirst*/); + return false; + } + + void operator() (const Vector3& p, uint32 Idx) + { + if (const T* obj = objects[Idx]) + _callback(p, *obj); + } + }; + + typedef G3D::Array ObjArray; + + BIH m_tree; + ObjArray m_objects; + G3D::Table m_obj2Idx; + G3D::Set m_objects_to_push; + int unbalanced_times; + +public: + BIHWrap() : unbalanced_times(0) {} + + void insert(const T& obj) + { + ++unbalanced_times; + m_objects_to_push.insert(&obj); + } + + void remove(const T& obj) + { + ++unbalanced_times; + uint32 Idx = 0; + const T * temp; + if (m_obj2Idx.getRemove(&obj, temp, Idx)) + m_objects[Idx] = NULL; + else + m_objects_to_push.remove(&obj); + } + + void balance() + { + if (unbalanced_times == 0) + return; + + unbalanced_times = 0; + m_objects.fastClear(); + m_obj2Idx.getKeys(m_objects); + m_objects_to_push.getMembers(m_objects); + + m_tree.build(m_objects, BoundsFunc::getBounds2); + } + + template + void intersectRay(const Ray& ray, RayCallback& intersectCallback, float& maxDist) const + { + MDLCallback temp_cb(intersectCallback, m_objects.getCArray()); + m_tree.intersectRay(ray, temp_cb, maxDist, true); + } + + template + void intersectPoint(const Vector3& point, IsectCallback& intersectCallback) const + { + MDLCallback callback(intersectCallback, m_objects.getCArray()); + m_tree.intersectPoint(point, callback); + } +}; + +#endif // _BIH_WRAP \ No newline at end of file diff --git a/src/server/collision/CMakeLists.txt b/src/server/collision/CMakeLists.txt index e2e182626c7..9fc696ab19a 100644 --- a/src/server/collision/CMakeLists.txt +++ b/src/server/collision/CMakeLists.txt @@ -39,9 +39,36 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/shared/Database ${CMAKE_SOURCE_DIR}/src/server/shared/Debugging ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic + ${CMAKE_SOURCE_DIR}/src/server/shared/Dynamic/LinkedReference ${CMAKE_SOURCE_DIR}/src/server/shared/Logging ${CMAKE_SOURCE_DIR}/src/server/shared/Threading + ${CMAKE_SOURCE_DIR}/src/server/shared/Packets + ${CMAKE_SOURCE_DIR}/src/server/shared/Utilities + ${CMAKE_SOURCE_DIR}/src/server/shared/DataStores + ${CMAKE_SOURCE_DIR}/src/server/game/Addons ${CMAKE_SOURCE_DIR}/src/server/game/Conditions + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Item + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/GameObject + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Creature + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Object/Updates + ${CMAKE_SOURCE_DIR}/src/server/game/Entities/Unit + ${CMAKE_SOURCE_DIR}/src/server/game/Combat + ${CMAKE_SOURCE_DIR}/src/server/game/Loot + ${CMAKE_SOURCE_DIR}/src/server/game/Miscellaneous + ${CMAKE_SOURCE_DIR}/src/server/game/Grids + ${CMAKE_SOURCE_DIR}/src/server/game/Grids/Cells + ${CMAKE_SOURCE_DIR}/src/server/game/Grids/Notifiers + ${CMAKE_SOURCE_DIR}/src/server/game/Maps + ${CMAKE_SOURCE_DIR}/src/server/game/DataStores + ${CMAKE_SOURCE_DIR}/src/server/game/Movement/Waypoints + ${CMAKE_SOURCE_DIR}/src/server/game/Movement/Spline + ${CMAKE_SOURCE_DIR}/src/server/game/Movement + ${CMAKE_SOURCE_DIR}/src/server/game/Server + ${CMAKE_SOURCE_DIR}/src/server/game/Server/Protocol + ${CMAKE_SOURCE_DIR}/src/server/game/World + ${CMAKE_SOURCE_DIR}/src/server/game/Spells + ${CMAKE_SOURCE_DIR}/src/server/game/Spells/Auras ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/Management ${CMAKE_CURRENT_SOURCE_DIR}/Maps diff --git a/src/server/collision/DynamicTree.cpp b/src/server/collision/DynamicTree.cpp new file mode 100644 index 00000000000..1d6877d1209 --- /dev/null +++ b/src/server/collision/DynamicTree.cpp @@ -0,0 +1,206 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "DynamicTree.h" +//#include "QuadTree.h" +//#include "RegularGrid.h" +#include "BoundingIntervalHierarchyWrapper.h" + +#include "Log.h" +#include "RegularGrid.h" +#include "Timer.h" +#include "GameObjectModel.h" +#include "ModelInstance.h" + +using VMAP::ModelInstance; +using G3D::Ray; + +template<> struct HashTrait< GameObjectModel>{ + static size_t hashCode(const GameObjectModel& g) { return (size_t)(void*)&g; } +}; + +template<> struct PositionTrait< GameObjectModel> { + static void getPosition(const GameObjectModel& g, Vector3& p) { p = g.getPosition(); } +}; + +template<> struct BoundsTrait< GameObjectModel> { + static void getBounds(const GameObjectModel& g, G3D::AABox& out) { out = g.getBounds();} + static void getBounds2(const GameObjectModel* g, G3D::AABox& out) { out = g->getBounds();} +}; + +static bool operator == (const GameObjectModel& mdl, const GameObjectModel& mdl2){ + return &mdl == &mdl2; +} + + +int valuesPerNode = 5, numMeanSplits = 3; + +int UNBALANCED_TIMES_LIMIT = 5; +int CHECK_TREE_PERIOD = 200; + +typedef RegularGrid2D > ParentTree; + +struct DynTreeImpl : public ParentTree/*, public Intersectable*/ +{ + typedef GameObjectModel Model; + typedef ParentTree base; + + DynTreeImpl() : + rebalance_timer(CHECK_TREE_PERIOD), + unbalanced_times(0) + { + } + + void insert(const Model& mdl) + { + base::insert(mdl); + ++unbalanced_times; + } + + void remove(const Model& mdl) + { + base::remove(mdl); + ++unbalanced_times; + } + + void balance() + { + base::balance(); + unbalanced_times = 0; + } + + void update(uint32 difftime) + { + if (!size()) + return; + + rebalance_timer.Update(difftime); + if (rebalance_timer.Passed()) + { + rebalance_timer.Reset(CHECK_TREE_PERIOD); + if (unbalanced_times > 0) + balance(); + } + } + + TimeTrackerSmall rebalance_timer; + int unbalanced_times; +}; + +DynamicMapTree::DynamicMapTree() : impl(*new DynTreeImpl()) +{ +} + +DynamicMapTree::~DynamicMapTree() +{ + delete &impl; +} + +void DynamicMapTree::insert(const GameObjectModel& mdl) +{ + impl.insert(mdl); +} + +void DynamicMapTree::remove(const GameObjectModel& mdl) +{ + impl.remove(mdl); +} + +bool DynamicMapTree::contains(const GameObjectModel& mdl) const +{ + return impl.contains(mdl); +} + +void DynamicMapTree::balance() +{ + impl.balance(); +} + +int DynamicMapTree::size() const +{ + return impl.size(); +} + +void DynamicMapTree::update(uint32 t_diff) +{ + impl.update(t_diff); +} + +struct DynamicTreeIntersectionCallback +{ + bool did_hit; + uint32 phase_mask; + DynamicTreeIntersectionCallback(uint32 phasemask) : did_hit(false), phase_mask(phasemask) {} + bool operator()(const Ray& r, const GameObjectModel& obj, float& distance) + { + did_hit = obj.intersectRay(r, distance, true, phase_mask); + return did_hit; + } + bool didHit() const { return did_hit;} +}; + +struct DynamicTreeIntersectionCallback_WithLogger +{ + bool did_hit; + uint32 phase_mask; + DynamicTreeIntersectionCallback_WithLogger(uint32 phasemask) : did_hit(false), phase_mask(phasemask) + { + sLog->outDebug(LOG_FILTER_MAPS, "Dynamic Intersection log"); + } + bool operator()(const Ray& r, const GameObjectModel& obj, float& distance) + { + sLog->outDebug(LOG_FILTER_MAPS, "testing intersection with %s", obj.name.c_str()); + bool hit = obj.intersectRay(r, distance, true, phase_mask); + if (hit) + { + did_hit = true; + sLog->outDebug(LOG_FILTER_MAPS, "result: intersects"); + } + return hit; + } + bool didHit() const { return did_hit;} +}; + +bool DynamicMapTree::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const +{ + Vector3 v1(x1,y1,z1), v2(x2,y2,z2); + + float maxDist = (v2 - v1).magnitude(); + + if (!G3D::fuzzyGt(maxDist, 0) ) + return true; + + Ray r(v1, (v2-v1) / maxDist); + DynamicTreeIntersectionCallback callback(phasemask); + impl.intersectRay(r, callback, maxDist, v2); + + return !callback.did_hit; +} + +float DynamicMapTree::getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const +{ + Vector3 v(x,y,z); + Ray r(v, Vector3(0,0,-1)); + DynamicTreeIntersectionCallback callback(phasemask); + impl.intersectZAllignedRay(r, callback, maxSearchDist); + + if (callback.didHit()) + return v.z - maxSearchDist; + else + return -G3D::inf(); +} \ No newline at end of file diff --git a/src/server/collision/DynamicTree.h b/src/server/collision/DynamicTree.h new file mode 100644 index 00000000000..ab28641b6ad --- /dev/null +++ b/src/server/collision/DynamicTree.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + + +#ifndef _DYNTREE_H +#define _DYNTREE_H + +#include +#include +#include +#include + +//#include "ModelInstance.h" +#include "Define.h" +//#include "GameObjectModel.h" + +namespace G3D +{ + class Vector3; +} + +using G3D::Vector3; +class GameObjectModel; + +class DynamicMapTree +{ + struct DynTreeImpl& impl; +public: + + DynamicMapTree(); + ~DynamicMapTree(); + + bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const; + float getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const; + + void insert(const GameObjectModel&); + void remove(const GameObjectModel&); + bool contains(const GameObjectModel&) const; + int size() const; + + void balance(); + void update(uint32 diff); +}; + +#endif // _DYNTREE_H diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp index 355ef6b1944..62968e4dedd 100644 --- a/src/server/collision/Maps/TileAssembler.cpp +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -16,7 +16,6 @@ * with this program. If not, see . */ -#include "WorldModel.h" #include "TileAssembler.h" #include "MapTree.h" #include "BoundingIntervalHierarchy.h" @@ -71,7 +70,6 @@ namespace VMAP bool TileAssembler::convertWorld2() { - std::set spawnedModelFiles; bool success = readMapSpawns(); if (!success) return false; @@ -178,6 +176,8 @@ namespace VMAP // break; //test, extract only first map; TODO: remvoe this line } + // add an object models, listed in temp_gameobject_models file + exportGameobjectModels(); // export objects std::cout << "\nConverting Model Files" << std::endl; for (std::set::iterator mfile = spawnedModelFiles.begin(); mfile != spawnedModelFiles.end(); ++mfile) @@ -251,99 +251,40 @@ namespace VMAP modelPosition.iScale = spawn.iScale; modelPosition.init(); - FILE* rf = fopen(modelFilename.c_str(), "rb"); - if (!rf) - { - printf("ERROR: Can't open model file: %s\n", modelFilename.c_str()); + WorldModel_Raw raw_model; + if (!raw_model.Read(modelFilename.c_str())) return false; - } + uint32 groups = raw_model.groupsArray.size(); + if (groups != 1) + printf("Warning: '%s' does not seem to be a M2 model!\n", modelFilename.c_str()); + AABox modelBound; bool boundEmpty=true; - char ident[8]; - - int readOperation = 1; - - // temporary use defines to simplify read/check code (close file and return at fail) - #define READ_OR_RETURN(V, S) if (fread((V), (S), 1, rf) != 1) { \ - fclose(rf); printf("readfail, op = %i\n", readOperation); return(false); }readOperation++; - // only use this for array deletes - #define READ_OR_RETURN_WITH_DELETE(V, S) if (fread((V), (S), 1, rf) != 1) { \ - fclose(rf); printf("readfail, op = %i\n", readOperation); delete[] V; return(false); }readOperation++; - - #define CMP_OR_RETURN(V, S) if (strcmp((V), (S)) != 0) { \ - fclose(rf); printf("cmpfail, %s!=%s\n", V, S);return(false); } - - READ_OR_RETURN(&ident, 8); - CMP_OR_RETURN(ident, "VMAP003"); - - // we have to read one int. This is needed during the export and we have to skip it here - uint32 tempNVectors; - READ_OR_RETURN(&tempNVectors, sizeof(tempNVectors)); - - uint32 groups, wmoRootId; - char blockId[5]; - blockId[4] = 0; - int blocksize; - float *vectorarray = 0; - - READ_OR_RETURN(&groups, sizeof(uint32)); - READ_OR_RETURN(&wmoRootId, sizeof(uint32)); - if (groups != 1) printf("Warning: '%s' does not seem to be a M2 model!\n", modelFilename.c_str()); for (uint32 g=0; g& vertices = raw_model.groupsArray[g].vertexArray; - if (nvectors >0) - { - vectorarray = new float[nvectors*3]; - READ_OR_RETURN_WITH_DELETE(vectorarray, nvectors*sizeof(float)*3); - } - else + if (vertices.empty()) { std::cout << "error: model '" << spawn.name << "' has no geometry!" << std::endl; - fclose(rf); - return false; + continue; } - for (uint32 i=0, indexNo=0; indexNo0) filename.push_back('/'); filename.append(pModelFilename); - FILE* rf = fopen(filename.c_str(), "rb"); - if (!rf) - { - printf("ERROR: Can't open model file in form: %s", pModelFilename.c_str()); - printf("... or form: %s", filename.c_str() ); + WorldModel_Raw raw_model; + if (!raw_model.Read(filename.c_str())) return false; + + // write WorldModel + WorldModel model; + model.setRootWmoID(raw_model.RootWMOID); + if (raw_model.groupsArray.size()) + { + std::vector groupsArray; + + uint32 groups = raw_model.groupsArray.size(); + for (uint32 g = 0; g < groups; ++g) + { + GroupModel_Raw& raw_group = raw_model.groupsArray[g]; + groupsArray.push_back(GroupModel(raw_group.mogpflags, raw_group.GroupWMOID, raw_group.bounds )); + groupsArray.back().setMeshData(raw_group.vertexArray, raw_group.triangles); + groupsArray.back().setLiquidData(raw_group.liquid); + } + + model.setGroupModels(groupsArray); } + + success = model.writeFile(iDestDir + "/" + pModelFilename + ".vmo"); + //std::cout << "readRawFile2: '" << pModelFilename << "' tris: " << nElements << " nodes: " << nNodes << std::endl; + return success; + } + + void TileAssembler::exportGameobjectModels() + { + FILE* model_list = fopen((iSrcDir + "/" + GAMEOBJECT_MODELS).c_str(), "rb"); + FILE* model_list_copy = fopen((iDestDir + "/" + GAMEOBJECT_MODELS).c_str(), "wb"); + if (!model_list || !model_list_copy) + return; + + uint32 name_length, displayId; + char buff[500]; + while (!feof(model_list)) + { + fread(&displayId,sizeof(uint32),1,model_list); + fread(&name_length,sizeof(uint32),1,model_list); - char ident[8]; + if (name_length >= sizeof(buff)) + { + std::cout << "\nFile 'temp_gameobject_models' seems to be corrupted" << std::endl; + break; + } + + fread(&buff,sizeof(char),name_length,model_list); + std::string model_name(buff, name_length); + + WorldModel_Raw raw_model; + if ( !raw_model.Read((iSrcDir + "/" + model_name).c_str()) ) + continue; - int readOperation = 1; + spawnedModelFiles.insert(model_name); + AABox bounds; + bool boundEmpty = true; + for (uint32 g = 0; g < raw_model.groupsArray.size(); ++g) + { + std::vector& vertices = raw_model.groupsArray[g].vertexArray; + + uint32 nvectors = vertices.size(); + for (uint32 i = 0; i < nvectors; ++i) + { + Vector3& v = vertices[i]; + if (boundEmpty) + bounds = AABox(v, v), boundEmpty = false; + else + bounds.merge(v); + } + } + + fwrite(&displayId,sizeof(uint32),1,model_list_copy); + fwrite(&name_length,sizeof(uint32),1,model_list_copy); + fwrite(&buff,sizeof(char),name_length,model_list_copy); + fwrite(&bounds.low(),sizeof(Vector3),1,model_list_copy); + fwrite(&bounds.high(),sizeof(Vector3),1,model_list_copy); + } + fclose(model_list); + fclose(model_list_copy); + } // temporary use defines to simplify read/check code (close file and return at fail) #define READ_OR_RETURN(V, S) if (fread((V), (S), 1, rf) != 1) { \ - fclose(rf); printf("readfail, op = %i\n", readOperation); return(false); }readOperation++; + fclose(rf); printf("readfail, op = %i\n", readOperation); return(false); } #define READ_OR_RETURN_WITH_DELETE(V, S) if (fread((V), (S), 1, rf) != 1) { \ - fclose(rf); printf("readfail, op = %i\n", readOperation); delete[] V; return(false); }readOperation++; + fclose(rf); printf("readfail, op = %i\n", readOperation); delete[] V; return(false); }; #define CMP_OR_RETURN(V, S) if (strcmp((V), (S)) != 0) { \ fclose(rf); printf("cmpfail, %s!=%s\n", V, S);return(false); } - READ_OR_RETURN(&ident, 8); - CMP_OR_RETURN(ident, "VMAP003"); - - // we have to read one int. This is needed during the export and we have to skip it here - uint32 tempNVectors; - READ_OR_RETURN(&tempNVectors, sizeof(tempNVectors)); - - uint32 groups; - uint32 RootWMOID; + bool GroupModel_Raw::Read(FILE* rf) + { char blockId[5]; blockId[4] = 0; int blocksize; - - READ_OR_RETURN(&groups, sizeof(uint32)); - READ_OR_RETURN(&RootWMOID, sizeof(uint32)); - - std::vector groupsArray; - - for (uint32 g=0; g triangles; - std::vector vertexArray; + uint32 indexes; + // indexes for each branch (not used jet) + READ_OR_RETURN(&indexes, sizeof(uint32)); + } - uint32 mogpflags, GroupWMOID; - READ_OR_RETURN(&mogpflags, sizeof(uint32)); - READ_OR_RETURN(&GroupWMOID, sizeof(uint32)); + // ---- indexes + READ_OR_RETURN(&blockId, 4); + CMP_OR_RETURN(blockId, "INDX"); + READ_OR_RETURN(&blocksize, sizeof(int)); + uint32 nindexes; + READ_OR_RETURN(&nindexes, sizeof(uint32)); + if (nindexes >0) + { + uint16 *indexarray = new uint16[nindexes]; + READ_OR_RETURN_WITH_DELETE(indexarray, nindexes*sizeof(uint16)); + triangles.reserve(nindexes / 3); + for (uint32 i=0; i0) - { - uint16 *indexarray = new uint16[nindexes]; - READ_OR_RETURN_WITH_DELETE(indexarray, nindexes*sizeof(uint16)); - for (uint32 i=0; i0) + { + float *vectorarray = new float[nvectors*3]; + READ_OR_RETURN_WITH_DELETE(vectorarray, nvectors*sizeof(float)*3); + for (uint32 i=0; iGetHeightStorage(), size*sizeof(float)); + size = hlq.xtiles*hlq.ytiles; + READ_OR_RETURN(liquid->GetFlagsStorage(), size); + } + + return true; + } - if (nvectors >0) - { - float *vectorarray = new float[nvectors*3]; - READ_OR_RETURN_WITH_DELETE(vectorarray, nvectors*sizeof(float)*3); - for (uint32 i=0; iGetHeightStorage(), size*sizeof(float)); - size = hlq.xtiles*hlq.ytiles; - READ_OR_RETURN(liquid->GetFlagsStorage(), size); - } - groupsArray.push_back(GroupModel(mogpflags, GroupWMOID, AABox(Vector3(bbox1), Vector3(bbox2)))); - groupsArray.back().setMeshData(vertexArray, triangles); - groupsArray.back().setLiquidData(liquid); + GroupModel_Raw::~GroupModel_Raw() + { + delete liquid; + } + + bool WorldModel_Raw::Read(const char * path) + { + FILE* rf = fopen(path, "rb"); + if (!rf) + { + printf("ERROR: Can't open raw model file: %s\n", path); + return false; + } + + char ident[8]; + int readOperation = 0; - // drop of temporary use defines - #undef READ_OR_RETURN - #undef READ_OR_RETURN_WITH_DELETE - #undef CMP_OR_RETURN + READ_OR_RETURN(&ident, 8); + CMP_OR_RETURN(ident, RAW_VMAP_MAGIC); - } - fclose(rf); + // we have to read one int. This is needed during the export and we have to skip it here + uint32 tempNVectors; + READ_OR_RETURN(&tempNVectors, sizeof(tempNVectors)); - // write WorldModel - WorldModel model; - model.setRootWmoID(RootWMOID); - if (!groupsArray.empty()) - { - model.setGroupModels(groupsArray); + uint32 groups; + READ_OR_RETURN(&groups, sizeof(uint32)); + READ_OR_RETURN(&RootWMOID, sizeof(uint32)); - std::string worldModelFileName(iDestDir); - worldModelFileName.push_back('/'); - worldModelFileName.append(pModelFilename).append(".vmo"); - success = model.writeFile(worldModelFileName); - } + groupsArray.resize(groups); + bool succeed = true; + for (uint32 g = 0; g < groups && succeed; ++g) + succeed = groupsArray[g].Read(rf); - //std::cout << "readRawFile2: '" << pModelFilename << "' tris: " << nElements << " nodes: " << nNodes << std::endl; - return success; + fclose(rf); + return succeed; } + + // drop of temporary use defines + #undef READ_OR_RETURN + #undef CMP_OR_RETURN } diff --git a/src/server/collision/Maps/TileAssembler.h b/src/server/collision/Maps/TileAssembler.h index 6128a0d2a53..554940a4663 100755 --- a/src/server/collision/Maps/TileAssembler.h +++ b/src/server/collision/Maps/TileAssembler.h @@ -22,8 +22,10 @@ #include #include #include +#include #include "ModelInstance.h" +#include "WorldModel.h" namespace VMAP { @@ -61,6 +63,31 @@ namespace VMAP typedef std::map MapData; //=============================================== + struct GroupModel_Raw + { + uint32 mogpflags; + uint32 GroupWMOID; + + G3D::AABox bounds; + uint32 liquidflags; + std::vector triangles; + std::vector vertexArray; + class WmoLiquid *liquid; + + GroupModel_Raw() : liquid(0) {} + ~GroupModel_Raw(); + + bool Read(FILE * f); + }; + + struct WorldModel_Raw + { + uint32 RootWMOID; + std::vector groupsArray; + + bool Read(const char * path); + }; + class TileAssembler { private: @@ -70,6 +97,7 @@ namespace VMAP G3D::Table iUniqueNameIds; unsigned int iCurrentUniqueNameId; MapData mapData; + std::set spawnedModelFiles; public: TileAssembler(const std::string& pSrcDirName, const std::string& pDestDirName); @@ -78,6 +106,7 @@ namespace VMAP bool convertWorld2(); bool readMapSpawns(); bool calculateTransformedBound(ModelSpawn &spawn); + void exportGameobjectModels(); bool convertRawFile(const std::string& pModelFilename); void setModelNameFilterMethod(bool (*pFilterMethod)(char *pName)) { iFilterMethod = pFilterMethod; } diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp new file mode 100644 index 00000000000..5ad984fcb4b --- /dev/null +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "VMapFactory.h" +#include "VMapManager2.h" +#include "VMapDefinitions.h" +#include "WorldModel.h" + +#include "GameObjectModel.h" +#include "Log.h" +#include "GameObject.h" +#include "Creature.h" +#include "TemporarySummon.h" +#include "Object.h" +#include "DBCStores.h" + +using G3D::Vector3; +using G3D::Ray; +using G3D::AABox; + +struct GameobjectModelData +{ + GameobjectModelData(const std::string& name_, const AABox& box) : + name(name_), bound(box) {} + + AABox bound; + std::string name; +}; + +typedef UNORDERED_MAP ModelList; +ModelList model_list; + +void LoadGameObjectModelList() +{ + FILE* model_list_file = fopen((sWorld->GetDataPath() + "vmaps/" + VMAP::GAMEOBJECT_MODELS).c_str(), "rb"); + if (!model_list_file) + return; + + uint32 name_length, displayId; + char buff[500]; + while (!feof(model_list_file)) + { + fread(&displayId,sizeof(uint32),1,model_list_file); + fread(&name_length,sizeof(uint32),1,model_list_file); + + if (name_length >= sizeof(buff)) + { + printf("\nFile '%s' seems to be corrupted", VMAP::GAMEOBJECT_MODELS); + break; + } + + fread(&buff, sizeof(char), name_length,model_list_file); + Vector3 v1, v2; + fread(&v1, sizeof(Vector3), 1, model_list_file); + fread(&v2, sizeof(Vector3), 1, model_list_file); + + model_list.insert + ( + ModelList::value_type( displayId, GameobjectModelData(std::string(buff,name_length),AABox(v1,v2)) ) + ); + } + fclose(model_list_file); +} + +GameObjectModel::~GameObjectModel() +{ + if (iModel) + ((VMAP::VMapManager2*)VMAP::VMapFactory::createOrGetVMapManager())->releaseModelInstance(name); +} + +bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info) +{ + ModelList::const_iterator it = model_list.find(info.Displayid); + if (it == model_list.end()) + return false; + + G3D::AABox mdl_box(it->second.bound); + // ignore models with no bounds + if (mdl_box == G3D::AABox::zero()) + { + std::cout << "Model " << it->second.name << " has zero bounds, loading skipped" << std::endl; + return false; + } + + iModel = ((VMAP::VMapManager2*)VMAP::VMapFactory::createOrGetVMapManager())->acquireModelInstance(sWorld->GetDataPath() + "vmaps/", it->second.name); + + if (!iModel) + return false; + + name = it->second.name; + //flags = VMAP::MOD_M2; + //adtId = 0; + //ID = 0; + iPos = Vector3(go.GetPositionX(), go.GetPositionY(), go.GetPositionZ()); + phasemask = go.GetPhaseMask(); + iScale = go.GetFloatValue(OBJECT_FIELD_SCALE_X); + iInvScale = 1.f / iScale; + + G3D::Matrix3 iRotation = G3D::Matrix3::fromEulerAnglesZYX(go.GetOrientation(), 0, 0); + iInvRot = iRotation.inverse(); + // transform bounding box: + mdl_box = AABox(mdl_box.low() * iScale, mdl_box.high() * iScale); + AABox rotated_bounds; + for (int i = 0; i < 8; ++i) + rotated_bounds.merge(iRotation * mdl_box.corner(i)); + + this->iBound = rotated_bounds + iPos; +#ifdef SPAWN_CORNERS + // test: + for (int i = 0; i < 8; ++i) + { + Vector3 pos(iBound.corner(i)); + if (Creature* c = const_cast(go).SummonCreature(24440, pos.x, pos.y, pos.z, 0, TEMPSUMMON_MANUAL_DESPAWN)) + { + c->setFaction(35); + c->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.1f); + } + } +#endif + + return true; +} + +GameObjectModel* GameObjectModel::Create(const GameObject& go) +{ + const GameObjectDisplayInfoEntry* info = sGameObjectDisplayInfoStore.LookupEntry(go.GetGOInfo()->displayId); + if (!info) + return NULL; + + GameObjectModel* mdl = new GameObjectModel(); + if (!mdl->initialize(go, *info)) + { + delete mdl; + return NULL; + } + + return mdl; +} + +bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const +{ + if (!(phasemask & ph_mask)) + return false; + + float time = ray.intersectionTime(iBound); + if (time == G3D::inf()) + return false; + + // child bounds are defined in object space: + Vector3 p = iInvRot * (ray.origin() - iPos) * iInvScale; + Ray modRay(p, iInvRot * ray.direction()); + float distance = MaxDist * iInvScale; + bool hit = iModel->IntersectRay(modRay, distance, StopAtFirstHit); + if(hit) + { + distance *= iScale; + MaxDist = distance; + } + return hit; +} \ No newline at end of file diff --git a/src/server/collision/Models/GameObjectModel.h b/src/server/collision/Models/GameObjectModel.h new file mode 100644 index 00000000000..413061c0de0 --- /dev/null +++ b/src/server/collision/Models/GameObjectModel.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2008-2012 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef _GAMEOBJECT_MODEL_H +#define _GAMEOBJECT_MODEL_H + +#include +#include +#include +#include + +#include "Define.h" + +namespace VMAP +{ + class WorldModel; +} + +class GameObject; +struct GameObjectDisplayInfoEntry; + +class GameObjectModel /*, public Intersectable*/ +{ + uint32 phasemask; + G3D::AABox iBound; + G3D::Matrix3 iInvRot; + G3D::Vector3 iPos; + //G3D::Vector3 iRot; + float iInvScale; + float iScale; + VMAP::WorldModel* iModel; + + GameObjectModel() : phasemask(0), iModel(NULL) {} + bool initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info); + +public: + std::string name; + + const G3D::AABox& getBounds() const { return iBound; } + + ~GameObjectModel(); + + const G3D::Vector3& getPosition() const { return iPos;} + + /** Enables\disables collision. */ + void disable() { phasemask = 0;} + void enable(uint32 ph_mask) { phasemask = ph_mask;} + + bool intersectRay(const G3D::Ray& Ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const; + + static GameObjectModel* Create(const GameObject& go); +}; + +#endif // _GAMEOBJECT_MODEL_H \ No newline at end of file diff --git a/src/server/collision/Models/WorldModel.h b/src/server/collision/Models/WorldModel.h index 52ecf498700..ebf828e4935 100755 --- a/src/server/collision/Models/WorldModel.h +++ b/src/server/collision/Models/WorldModel.h @@ -80,7 +80,7 @@ namespace VMAP //! pass mesh data to object and create BIH. Passed vectors get get swapped with old geometry! void setMeshData(std::vector &vert, std::vector &tri); - void setLiquidData(WmoLiquid* liquid) { iLiquid = liquid; } + void setLiquidData(WmoLiquid*& liquid) { iLiquid = liquid; liquid = NULL; } bool IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit) const; bool IsInsideObject(const Vector3 &pos, const Vector3 &down, float &z_dist) const; bool GetLiquidLevel(const Vector3 &pos, float &liqHeight) const; diff --git a/src/server/collision/RegularGrid.h b/src/server/collision/RegularGrid.h new file mode 100644 index 00000000000..be61504bc65 --- /dev/null +++ b/src/server/collision/RegularGrid.h @@ -0,0 +1,218 @@ +#ifndef _REGULAR_GRID_H +#define _REGULAR_GRID_H + + +#include +#include +#include +#include +#include + +#include "Errors.h" + +using G3D::Vector2; +using G3D::Vector3; +using G3D::AABox; +using G3D::Ray; + +template +struct NodeCreator{ + static Node * makeNode(int x, int y) { return new Node();} +}; + +template, + /*class BoundsFunc = BoundsTrait,*/ +class PositionFunc = PositionTrait +> +class RegularGrid2D +{ +public: + + enum{ + CELL_NUMBER = 64, + }; + + #define HGRID_MAP_SIZE (533.33333f * 64.f) // shouldn't be changed + #define CELL_SIZE float(HGRID_MAP_SIZE/(float)CELL_NUMBER) + + typedef G3D::Table MemberTable; + + MemberTable memberTable; + Node* nodes[CELL_NUMBER][CELL_NUMBER]; + + RegularGrid2D(){ + memset(nodes, 0, sizeof(nodes)); + } + + ~RegularGrid2D(){ + for (int x = 0; x < CELL_NUMBER; ++x) + for (int y = 0; y < CELL_NUMBER; ++y) + delete nodes[x][y]; + } + + void insert(const T& value) + { + Vector3 pos; + PositionFunc::getPosition(value, pos); + Node& node = getGridFor(pos.x, pos.y); + node.insert(value); + memberTable.set(&value, &node); + } + + void remove(const T& value) + { + memberTable[&value]->remove(value); + // Remove the member + memberTable.remove(&value); + } + + void balance() + { + for (int x = 0; x < CELL_NUMBER; ++x) + for (int y = 0; y < CELL_NUMBER; ++y) + if (Node* n = nodes[x][y]) + n->balance(); + } + + bool contains(const T& value) const { return memberTable.containsKey(&value); } + int size() const { return memberTable.size(); } + + struct Cell + { + int x, y; + bool operator == (const Cell& c2) const { return x == c2.x && y == c2.y;} + + static Cell ComputeCell(float fx, float fy) + { + Cell c = {fx * (1.f/CELL_SIZE) + (CELL_NUMBER/2), fy * (1.f/CELL_SIZE) + (CELL_NUMBER/2)}; + return c; + } + + bool isValid() const { return x >= 0 && x < CELL_NUMBER && y >= 0 && y < CELL_NUMBER;} + }; + + + Node& getGridFor(float fx, float fy) + { + Cell c = Cell::ComputeCell(fx, fy); + return getGrid(c.x, c.y); + } + + Node& getGrid(int x, int y) + { + ASSERT(x < CELL_NUMBER && y < CELL_NUMBER); + if (!nodes[x][y]) + nodes[x][y] = NodeCreatorFunc::makeNode(x,y); + return *nodes[x][y]; + } + + template + void intersectRay(const Ray& ray, RayCallback& intersectCallback, float max_dist) + { + intersectRay(ray, intersectCallback, max_dist, ray.origin() + ray.direction() * max_dist); + } + + template + void intersectRay(const Ray& ray, RayCallback& intersectCallback, float& max_dist, const Vector3& end) + { + Cell cell = Cell::ComputeCell(ray.origin().x, ray.origin().y); + if (!cell.isValid()) + return; + + Cell last_cell = Cell::ComputeCell(end.x, end.y); + + if (cell == last_cell) + { + if (Node* node = nodes[cell.x][cell.y]) + node->intersectRay(ray, intersectCallback, max_dist); + return; + } + + float voxel = (float)CELL_SIZE; + float kx_inv = ray.invDirection().x, bx = ray.origin().x; + float ky_inv = ray.invDirection().y, by = ray.origin().y; + + int stepX, stepY; + float tMaxX, tMaxY; + if (kx_inv >= 0) + { + stepX = 1; + float x_border = (cell.x+1) * voxel; + tMaxX = (x_border - bx) * kx_inv; + } + else + { + stepX = -1; + float x_border = (cell.x-1) * voxel; + tMaxX = (x_border - bx) * kx_inv; + } + + if (ky_inv >= 0) + { + stepY = 1; + float y_border = (cell.y+1) * voxel; + tMaxY = (y_border - by) * ky_inv; + } + else + { + stepY = -1; + float y_border = (cell.y-1) * voxel; + tMaxY = (y_border - by) * ky_inv; + } + + //int Cycles = std::max((int)ceilf(max_dist/tMaxX),(int)ceilf(max_dist/tMaxY)); + //int i = 0; + + float tDeltaX = voxel * fabs(kx_inv); + float tDeltaY = voxel * fabs(ky_inv); + do + { + if (Node* node = nodes[cell.x][cell.y]) + { + //float enterdist = max_dist; + node->intersectRay(ray, intersectCallback, max_dist); + } + if (cell == last_cell) + break; + if(tMaxX < tMaxY) + { + tMaxX += tDeltaX; + cell.x += stepX; + } + else + { + tMaxY += tDeltaY; + cell.y += stepY; + } + //++i; + } while (cell.isValid()); + } + + template + void intersectPoint(const Vector3& point, IsectCallback& intersectCallback) + { + Cell cell = Cell::ComputeCell(point.x, point.y); + if (!cell.isValid()) + return; + if (Node* node = nodes[cell.x][cell.y]) + node->intersectPoint(point, intersectCallback); + } + + // Optimized verson of intersectRay function for rays with vertical directions + template + void intersectZAllignedRay(const Ray& ray, RayCallback& intersectCallback, float& max_dist) + { + Cell cell = Cell::ComputeCell(ray.origin().x, ray.origin().y); + if (!cell.isValid()) + return; + if (Node* node = nodes[cell.x][cell.y]) + node->intersectRay(ray, intersectCallback, max_dist); + } +}; + +#undef CELL_SIZE +#undef HGRID_MAP_SIZE + +#endif \ No newline at end of file diff --git a/src/server/collision/VMapDefinitions.h b/src/server/collision/VMapDefinitions.h index f7d6f0ddaa1..72a62807b4c 100644 --- a/src/server/collision/VMapDefinitions.h +++ b/src/server/collision/VMapDefinitions.h @@ -24,7 +24,9 @@ namespace VMAP { - const char VMAP_MAGIC[] = "VMAP_3.0"; + const char VMAP_MAGIC[] = "VMAP_4.0"; + const char RAW_VMAP_MAGIC[] = "VMAP004"; // used in extracted vmap files with raw data + const char GAMEOBJECT_MODELS[] = "temp_gameobject_models"; // defined in TileAssembler.cpp currently... bool readChunk(FILE* rf, char *dest, const char *compare, uint32 len); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 87f4ca48378..0a168491996 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -51,15 +51,19 @@ void BattlegroundDS::PostUpdateImpl(uint32 diff) if (isWaterFallActive()) { setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX)); - for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i) - SpawnBGObject(i, getWaterFallTimer()); + SpawnBGObject(BG_DS_OBJECT_WATER_2, getWaterFallTimer()); + // turn off collision + if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[BG_DS_OBJECT_WATER_1])) + gob->EnableCollision(false); setWaterFallActive(false); } else { setWaterFallTimer(BG_DS_WATERFALL_DURATION); - for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i) - SpawnBGObject(i, RESPAWN_IMMEDIATELY); + SpawnBGObject(BG_DS_OBJECT_WATER_2, RESPAWN_IMMEDIATELY); + // Turn on collision + if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[BG_DS_OBJECT_WATER_1])) + gob->EnableCollision(true); setWaterFallActive(true); } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index f2ba2cea1e7..1ec465864d5 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -25,7 +25,7 @@ enum BattlegroundDSObjectTypes { BG_DS_OBJECT_DOOR_1 = 0, BG_DS_OBJECT_DOOR_2 = 1, - BG_DS_OBJECT_WATER_1 = 2, + BG_DS_OBJECT_WATER_1 = 2, // Collision BG_DS_OBJECT_WATER_2 = 3, BG_DS_OBJECT_BUFF_1 = 4, BG_DS_OBJECT_BUFF_2 = 5, @@ -36,7 +36,7 @@ enum BattlegroundDSObjects { BG_DS_OBJECT_TYPE_DOOR_1 = 192642, BG_DS_OBJECT_TYPE_DOOR_2 = 192643, - BG_DS_OBJECT_TYPE_WATER_1 = 194395, + BG_DS_OBJECT_TYPE_WATER_1 = 194395, // Collision BG_DS_OBJECT_TYPE_WATER_2 = 191877, BG_DS_OBJECT_TYPE_BUFF_1 = 184663, BG_DS_OBJECT_TYPE_BUFF_2 = 184664 diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 539419d6c50..ac3ee2642f4 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -63,6 +63,7 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff) case BG_RV_STATE_OPEN_PILARS: for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i) DoorOpen(i); + TogglePillarCollision(false); setTimer(BG_RV_PILAR_TO_FIRE_TIMER); setState(BG_RV_STATE_OPEN_FIRE); break; @@ -76,6 +77,7 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff) case BG_RV_STATE_CLOSE_PILARS: for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i) DoorOpen(i); + TogglePillarCollision(true); setTimer(BG_RV_PILAR_TO_FIRE_TIMER); setState(BG_RV_STATE_CLOSE_FIRE); break; @@ -207,13 +209,13 @@ bool BattlegroundRV::SetupBattleground() || !AddObject(BG_RV_OBJECT_PILAR_2, BG_RV_OBJECT_TYPE_PILAR_2, 723.644287f, -284.493256f, 24.648525f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY) || !AddObject(BG_RV_OBJECT_PILAR_3, BG_RV_OBJECT_TYPE_PILAR_3, 763.611145f, -261.856750f, 25.909504f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY) || !AddObject(BG_RV_OBJECT_PILAR_4, BG_RV_OBJECT_TYPE_PILAR_4, 802.211609f, -284.493256f, 24.648525f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY) -/* - // Pilars Collision - Fixme: Use the collision pilars - should make u break LoS + + // Pilars Collision || !AddObject(BG_RV_OBJECT_PILAR_COLLISION_1, BG_RV_OBJECT_TYPE_PILAR_COLLISION_1, 763.632385f, -306.162384f, 30.639660f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY) || !AddObject(BG_RV_OBJECT_PILAR_COLLISION_2, BG_RV_OBJECT_TYPE_PILAR_COLLISION_2, 723.644287f, -284.493256f, 32.382710f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY) || !AddObject(BG_RV_OBJECT_PILAR_COLLISION_3, BG_RV_OBJECT_TYPE_PILAR_COLLISION_3, 763.611145f, -261.856750f, 30.639660f, 0.000000f, 0, 0, 0, RESPAWN_IMMEDIATELY) || !AddObject(BG_RV_OBJECT_PILAR_COLLISION_4, BG_RV_OBJECT_TYPE_PILAR_COLLISION_4, 802.211609f, -284.493256f, 32.382710f, 3.141593f, 0, 0, 0, RESPAWN_IMMEDIATELY) -*/ + ) { sLog->outErrorDb("BatteGroundRV: Failed to spawn some object!"); @@ -221,3 +223,23 @@ bool BattlegroundRV::SetupBattleground() } return true; } + + +void BattlegroundRV::TogglePillarCollision(bool apply) +{ + for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PILAR_COLLISION_4; ++i) + { + if (GameObject* gob = GetBgMap()->GetGameObject(m_BgObjects[i])) + { + bool startOpen = (gob->GetGoType() == GAMEOBJECT_TYPE_DOOR || gob->GetGoType() == GAMEOBJECT_TYPE_BUTTON ? gob->GetGOInfo()->door.startOpen : false); + if (startOpen) + gob->EnableCollision(!apply); + else + gob->EnableCollision(apply); + + for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER))) + gob->SendUpdateToPlayer(player); + } + } +} \ No newline at end of file diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h index 4f99af268db..1dfd4825c8f 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h @@ -38,12 +38,12 @@ enum BattlegroundRVObjectTypes BG_RV_OBJECT_PILAR_4, BG_RV_OBJECT_PULLEY_1, BG_RV_OBJECT_PULLEY_2, -/* + BG_RV_OBJECT_PILAR_COLLISION_1, BG_RV_OBJECT_PILAR_COLLISION_2, BG_RV_OBJECT_PILAR_COLLISION_3, BG_RV_OBJECT_PILAR_COLLISION_4, -*/ + BG_RV_OBJECT_ELEVATOR_1, BG_RV_OBJECT_ELEVATOR_2, BG_RV_OBJECT_MAX, @@ -64,12 +64,12 @@ enum BattlegroundRVObjects BG_RV_OBJECT_TYPE_GEAR_2 = 192394, BG_RV_OBJECT_TYPE_ELEVATOR_1 = 194582, BG_RV_OBJECT_TYPE_ELEVATOR_2 = 194586, -/* + BG_RV_OBJECT_TYPE_PILAR_COLLISION_1 = 194580, // axe BG_RV_OBJECT_TYPE_PILAR_COLLISION_2 = 194579, // arena BG_RV_OBJECT_TYPE_PILAR_COLLISION_3 = 194581, // lightning BG_RV_OBJECT_TYPE_PILAR_COLLISION_4 = 194578, // ivory -*/ + BG_RV_OBJECT_TYPE_PILAR_1 = 194583, // axe BG_RV_OBJECT_TYPE_PILAR_2 = 194584, // arena BG_RV_OBJECT_TYPE_PILAR_3 = 194585, // lightning @@ -129,5 +129,6 @@ class BattlegroundRV : public Battleground uint32 getState() { return State; }; void setState(uint32 state) { State = state; }; + void TogglePillarCollision(bool apply); }; #endif diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt index ac1bb9e5cac..cf24c923655 100644 --- a/src/server/game/CMakeLists.txt +++ b/src/server/game/CMakeLists.txt @@ -110,6 +110,8 @@ include_directories( ${CMAKE_SOURCE_DIR}/dep/zlib ${CMAKE_SOURCE_DIR}/src/server/collision ${CMAKE_SOURCE_DIR}/src/server/collision/Management + ${CMAKE_SOURCE_DIR}/src/server/collision/Models + ${CMAKE_SOURCE_DIR}/src/server/collision/Maps ${CMAKE_SOURCE_DIR}/src/server/shared ${CMAKE_SOURCE_DIR}/src/server/shared/Configuration ${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 15408ad03a9..adb7f0ac380 100755 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -955,7 +955,7 @@ struct FactionTemplateEntry struct GameObjectDisplayInfoEntry { uint32 Displayid; // 0 m_ID - // char* filename; // 1 + char* filename; // 1 //uint32 unk1[10]; //2-11 float minX; float minY; diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index c55fb79d461..150159feb11 100755 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -52,7 +52,7 @@ const char EmotesEntryfmt[]="nxxiiix"; const char EmotesTextEntryfmt[]="nxixxxxxxxxxxxxxxxx"; const char FactionEntryfmt[]="niiiiiiiiiiiiiiiiiiffixssssssssssssssssxxxxxxxxxxxxxxxxxx"; const char FactionTemplateEntryfmt[]="niiiiiiiiiiiii"; -const char GameObjectDisplayInfofmt[]="nxxxxxxxxxxxffffffx"; +const char GameObjectDisplayInfofmt[]="nsxxxxxxxxxxffffffx"; const char GemPropertiesEntryfmt[]="nixxi"; const char GlyphPropertiesfmt[]="niii"; const char GlyphSlotfmt[]="nii"; diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 23865dd9e41..7f767ea81dc 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1289,7 +1289,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap) m_deathState = DEAD; if (canFly()) { - float tz = map->GetHeight(data->posX, data->posY, data->posZ, false); + float tz = map->GetHeight(GetPhaseMask(), data->posX, data->posY, data->posZ, false); if (data->posZ - tz > 0.1f) Relocate(data->posX, data->posY, tz); } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 3548ef3bc63..4abc6e80b1e 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -30,7 +30,10 @@ #include "CreatureAISelector.h" #include "Group.h" -GameObject::GameObject() : WorldObject(false), m_goValue(new GameObjectValue), m_AI(NULL) +#include "GameObjectModel.h" +#include "DynamicTree.h" + +GameObject::GameObject() : WorldObject(false), m_goValue(new GameObjectValue), m_AI(NULL), m_model(NULL) { m_objectType |= TYPEMASK_GAMEOBJECT; m_objectTypeId = TYPEID_GAMEOBJECT; @@ -62,6 +65,7 @@ GameObject::~GameObject() { delete m_goValue; delete m_AI; + delete m_model; //if (m_uint32Values) // field array can be not exist if GameOBject not loaded // CleanupsBeforeDelete(); } @@ -127,6 +131,11 @@ void GameObject::AddToWorld() m_zoneScript->OnGameObjectCreate(this); sObjectAccessor->AddObject(this); + bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); + if (m_model/* && (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? !GetGOInfo()->door.startOpen : true)*/) + GetMap()->Insert(*m_model); + if (startOpen) + EnableCollision(false); WorldObject::AddToWorld(); } } @@ -140,6 +149,9 @@ void GameObject::RemoveFromWorld() m_zoneScript->OnGameObjectRemove(this); RemoveFromOwner(); + if (m_model) + if (GetMap()->Contains(*m_model)) + GetMap()->Remove(*m_model); WorldObject::RemoveFromWorld(); sObjectAccessor->RemoveObject(this); } @@ -199,14 +211,16 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa // set name for logs usage, doesn't affect anything ingame SetName(goinfo->name); - SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId); + SetDisplayId(goinfo->displayId); + m_model = GameObjectModel::Create(*this); // GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3 - SetGoState(go_state); SetGoType(GameobjectTypes(goinfo->type)); + SetGoState(go_state); SetGoArtKit(0); // unknown what this is SetByteValue(GAMEOBJECT_BYTES_1, 2, artKit); + switch (goinfo->type) { @@ -1779,7 +1793,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* { case GO_DESTRUCTIBLE_INTACT: RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_DESTROYED); - SetUInt32Value(GAMEOBJECT_DISPLAYID, m_goInfo->displayId); + SetDisplayId(m_goInfo->displayId); if (setHealth) { m_goValue->Building.Health = m_goValue->Building.MaxHealth; @@ -1801,7 +1815,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* if (DestructibleModelDataEntry const* modelData = sDestructibleModelDataStore.LookupEntry(m_goInfo->building.destructibleData)) if (modelData->DamagedDisplayId) modelId = modelData->DamagedDisplayId; - SetUInt32Value(GAMEOBJECT_DISPLAYID, modelId); + SetDisplayId(modelId); if (setHealth) { @@ -1834,7 +1848,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* if (DestructibleModelDataEntry const* modelData = sDestructibleModelDataStore.LookupEntry(m_goInfo->building.destructibleData)) if (modelData->DestroyedDisplayId) modelId = modelData->DestroyedDisplayId; - SetUInt32Value(GAMEOBJECT_DISPLAYID, modelId); + SetDisplayId(modelId); if (setHealth) { @@ -1852,7 +1866,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* if (DestructibleModelDataEntry const* modelData = sDestructibleModelDataStore.LookupEntry(m_goInfo->building.destructibleData)) if (modelData->RebuildingDisplayId) modelId = modelData->RebuildingDisplayId; - SetUInt32Value(GAMEOBJECT_DISPLAYID, modelId); + SetDisplayId(modelId); // restores to full health if (setHealth) @@ -1865,8 +1879,78 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player* } } -void GameObject::SetLootState(LootState s, Unit* unit) +void GameObject::SetLootState(LootState state, Unit* unit) { - m_lootState = s; - AI()->OnStateChanged(s, unit); + m_lootState = state; + AI()->OnStateChanged(state, unit); + if (m_model) + { + // startOpen determines whether we are going to add or remove the LoS on activation + bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); + + if (GetGOData()->go_state == GO_NOT_READY) + startOpen = !startOpen; + + if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED) + EnableCollision(startOpen); + else if (state == GO_READY) + EnableCollision(!startOpen); + } } + +void GameObject::SetGoState(GOState state) +{ + SetByteValue(GAMEOBJECT_BYTES_1, 0, state); + if (m_model) + { + if (!IsInWorld()) + return; + + // startOpen determines whether we are going to add or remove the LoS on activation + bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false); + + if (GetGOData()->go_state == GO_NOT_READY) + startOpen = !startOpen; + + if (state == GO_STATE_ACTIVE || state == GO_STATE_ACTIVE_ALTERNATIVE) + EnableCollision(startOpen); + else if (state == GO_STATE_READY) + EnableCollision(!startOpen); + } +} + +void GameObject::SetDisplayId(uint32 displayid) +{ + SetUInt32Value(GAMEOBJECT_DISPLAYID, displayid); + UpdateModel(); +} + +void GameObject::SetPhaseMask(uint32 newPhaseMask, bool update) +{ + WorldObject::SetPhaseMask(newPhaseMask, update); + EnableCollision(true); +} + +void GameObject::EnableCollision(bool enable) +{ + if (!m_model) + return; + + /*if (enable && !GetMap()->Contains(*m_model)) + GetMap()->Insert(*m_model);*/ + + m_model->enable(enable ? GetPhaseMask() : 0); +} + +void GameObject::UpdateModel() +{ + if (!IsInWorld()) + return; + if (m_model) + if (GetMap()->Contains(*m_model)) + GetMap()->Remove(*m_model); + delete m_model; + m_model = GameObjectModel::Create(*this); + if (m_model) + GetMap()->Insert(*m_model); +} \ No newline at end of file diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index f677d481c33..a4635ca6dfb 100755 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -609,6 +609,7 @@ enum LootState }; class Unit; +class GameObjectModel; // 5 sec for bobber catch #define FISHING_BOBBER_READY_TIME 5 @@ -703,12 +704,15 @@ class GameObject : public WorldObject, public GridObject GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); } void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); } GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); } - void SetGoState(GOState state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); } + void SetGoState(GOState state); uint8 GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1, 2); } void SetGoArtKit(uint8 artkit); uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); } void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); } static void SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid = 0); + + void SetPhaseMask(uint32 newPhaseMask, bool update); + void EnableCollision(bool enable); void Use(Unit* user); @@ -790,6 +794,9 @@ class GameObject : public WorldObject, public GridObject GameObjectAI* AI() const { return m_AI; } std::string GetAIName() const; + void SetDisplayId(uint32 displayid); + + GameObjectModel * m_model; protected: bool AIM_Initialize(); uint32 m_spellId; @@ -819,6 +826,7 @@ class GameObject : public WorldObject, public GridObject private: void RemoveFromOwner(); void SwitchDoorOrButton(bool activate, bool alternative = false); + void UpdateModel(); // updates model in case displayId were changed //! Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size. bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool /*is3D*/) const diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 732171da67a..7113fe8efb5 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -46,6 +46,7 @@ #include "Totem.h" #include "OutdoorPvPMgr.h" #include "MovementPacketBuilder.h" +#include "DynamicTree.h" uint32 GuidHigh2TypeId(uint32 guid_hi) { @@ -1300,15 +1301,19 @@ bool WorldObject::IsWithinLOSInMap(const WorldObject* obj) const float ox, oy, oz; obj->GetPosition(ox, oy, oz); - return(IsWithinLOS(ox, oy, oz)); + return IsWithinLOS(ox, oy, oz); } bool WorldObject::IsWithinLOS(float ox, float oy, float oz) const { - float x, y, z; + /*float x, y, z; GetPosition(x, y, z); VMAP::IVMapManager* vMapManager = VMAP::VMapFactory::createOrGetVMapManager(); - return vMapManager->isInLineOfSight(GetMapId(), x, y, z+2.0f, ox, oy, oz+2.0f); + return vMapManager->isInLineOfSight(GetMapId(), x, y, z+2.0f, ox, oy, oz+2.0f);*/ + if (IsInWorld()) + return GetMap()->isInLineOfSight(GetPositionX(), GetPositionY(), GetPositionZ()+2.f, ox, oy, oz+2.f, GetPhaseMask()); + + return true; } bool WorldObject::GetDistanceOrder(WorldObject const* obj1, WorldObject const* obj2, bool is3D /* = true */) const @@ -1530,7 +1535,7 @@ void WorldObject::GetRandomPoint(const Position &pos, float distance, float &ran void WorldObject::UpdateGroundPositionZ(float x, float y, float &z) const { - float new_z = GetBaseMap()->GetHeight(x, y, z, true); + float new_z = GetBaseMap()->GetHeight(GetPhaseMask(), x, y, z, true); if (new_z > INVALID_HEIGHT) z = new_z+ 0.05f; // just to be sure that we are not a few pixel under the surface } @@ -1549,7 +1554,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const float ground_z = z; float max_z = canSwim ? GetBaseMap()->GetWaterOrGroundLevel(x, y, z, &ground_z, !ToUnit()->HasAuraType(SPELL_AURA_WATER_WALK)) - : ((ground_z = GetBaseMap()->GetHeight(x, y, z, true))); + : ((ground_z = GetBaseMap()->GetHeight(GetPhaseMask(), x, y, z, true))); if (max_z > INVALID_HEIGHT) { if (z > max_z) @@ -1560,7 +1565,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const } else { - float ground_z = GetBaseMap()->GetHeight(x, y, z, true); + float ground_z = GetBaseMap()->GetHeight(GetPhaseMask(), x, y, z, true); if (z < ground_z) z = ground_z; } @@ -1583,7 +1588,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const } else { - float ground_z = GetBaseMap()->GetHeight(x, y, z, true); + float ground_z = GetBaseMap()->GetHeight(GetPhaseMask(), x, y, z, true); if (z < ground_z) z = ground_z; } @@ -1591,7 +1596,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const } default: { - float ground_z = GetBaseMap()->GetHeight(x, y, z, true); + float ground_z = GetBaseMap()->GetHeight(GetPhaseMask(), x, y, z, true); if(ground_z > INVALID_HEIGHT) z = ground_z; break; @@ -2665,8 +2670,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float destx = pos.m_positionX + dist * cos(angle); desty = pos.m_positionY + dist * sin(angle); - ground = GetMap()->GetHeight(destx, desty, MAX_HEIGHT, true); - floor = GetMap()->GetHeight(destx, desty, pos.m_positionZ, true); + ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); + floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true); destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor; bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), pos.m_positionX, pos.m_positionY, pos.m_positionZ+0.5f, destx, desty, destz+0.5f, destx, desty, destz, -0.5f); @@ -2689,8 +2694,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float { destx -= step * cos(angle); desty -= step * sin(angle); - ground = GetMap()->GetHeight(destx, desty, MAX_HEIGHT, true); - floor = GetMap()->GetHeight(destx, desty, pos.m_positionZ, true); + ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true); + floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true); destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor; } // we have correct destz now diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 67d1636c7e2..891cf6b6697 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -222,7 +222,7 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa SetUInt32Value(GAMEOBJECT_LEVEL, m_period); SetEntry(goinfo->entry); - SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId); + SetDisplayId(goinfo->displayId); SetGoState(GO_STATE_READY); SetGoType(GameobjectTypes(goinfo->type)); diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 5702eefffec..c907620193a 100755 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -251,7 +251,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) mapid = corpseMapEntry->entrance_map; x = corpseMapEntry->entrance_x; y = corpseMapEntry->entrance_y; - z = entranceMap->GetHeight(x, y, MAX_HEIGHT); + z = entranceMap->GetHeight(GetPlayer()->GetPhaseMask(), x, y, MAX_HEIGHT); } } } diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index df5ec540427..71fc2ef00a1 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -31,6 +31,7 @@ #include "ObjectMgr.h" #include "Group.h" #include "LFGMgr.h" +#include "DynamicTree.h" union u_map_magic { @@ -368,6 +369,7 @@ bool Map::EnsureGridLoaded(const Cell &cell) // Add resurrectable corpses to world object list in grid sObjectAccessor->AddCorpsesToGrid(GridCoord(cell.GridX(), cell.GridY()), grid->GetGridType(cell.CellX(), cell.CellY()), this); + Balance(); return true; } @@ -498,6 +500,7 @@ void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor(this)->GetGrid(x, y)) { // we need ground level (including grid height version) for proper return water level in point - float ground_z = GetHeight(x, y, z, true, 50.0f); + float ground_z = GetHeight(PHASEMASK_NORMAL, x, y, z, true, 50.0f); if (ground) *ground = ground_z; @@ -1793,6 +1796,17 @@ void Map::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 area zoneid = entry ? ((entry->zone != 0) ? entry->zone : entry->ID) : 0; } +bool Map::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const +{ + return VMAP::VMapFactory::createOrGetVMapManager()->isInLineOfSight(GetId(), x1, y1, z1, x2, y2, z2) + && m_dyn_tree.isInLineOfSight(x1, y1, z1, x2, y2, z2, phasemask); +} + +float Map::GetHeight(uint32 phasemask, float x, float y, float z, bool vmap/*=true*/, float maxSearchDist/*=DEFAULT_HEIGHT_SEARCH*/) const +{ + return std::max(GetHeight(x, y, z, vmap, maxSearchDist), m_dyn_tree.getHeight(x, y, z, maxSearchDist, phasemask)); +} + bool Map::IsInWater(float x, float y, float pZ, LiquidData* data) const { // Check surface in x, y point for liquid diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index f3b45bd8f37..7d234d5f75a 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -30,6 +30,8 @@ #include "SharedDefines.h" #include "GridRefManager.h" #include "MapRefManager.h" +#include "DynamicTree.h" +#include "GameObjectModel.h" #include #include @@ -425,7 +427,12 @@ class Map : public GridRefManager InstanceMap* ToInstanceMap(){ if (IsDungeon()) return reinterpret_cast(this); else return NULL; } const InstanceMap* ToInstanceMap() const { if (IsDungeon()) return (const InstanceMap*)((InstanceMap*)this); else return NULL; } float GetWaterOrGroundLevel(float x, float y, float z, float* ground = NULL, bool swim = false) const; - + float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const; + bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const; + void Balance() { m_dyn_tree.balance(); } + void Remove(const GameObjectModel& mdl) { m_dyn_tree.remove(mdl); } + void Insert(const GameObjectModel& mdl) { m_dyn_tree.insert(mdl); } + bool Contains(const GameObjectModel& mdl) const { return m_dyn_tree.contains(mdl);} private: void LoadMapAndVMap(int gx, int gy); void LoadVMap(int gx, int gy); @@ -481,6 +488,7 @@ class Map : public GridRefManager uint32 i_InstanceId; uint32 m_unloadTimer; float m_VisibleDistance; + DynamicMapTree m_dyn_tree; MapRefManager m_mapRefManager; MapRefManager::iterator m_mapRefIter; diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 8975a2d7d7b..adb7b5ca1a8 100755 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -374,7 +374,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee void MotionMaster::MoveFall(uint32 id/*=0*/) { // use larger distance for vmap height search than in most other cases - float tz = i_owner->GetMap()->GetHeight(i_owner->GetPositionX(), i_owner->GetPositionY(), i_owner->GetPositionZ(), true, MAX_FALL_DISTANCE); + float tz = i_owner->GetMap()->GetHeight(i_owner->GetPhaseMask(), i_owner->GetPositionX(), i_owner->GetPositionY(), i_owner->GetPositionZ(), true, MAX_FALL_DISTANCE); if (tz <= INVALID_HEIGHT) { sLog->outStaticDebug("MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).", @@ -387,7 +387,7 @@ void MotionMaster::MoveFall(uint32 id/*=0*/) return; Movement::MoveSplineInit init(*i_owner); - init.MoveTo(i_owner->GetPositionX(),i_owner->GetPositionY(),tz); + init.MoveTo(i_owner->GetPositionX(), i_owner->GetPositionY(), tz); init.SetFall(); init.Launch(); Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp index 458e6f9a62c..1a628ae076b 100755 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp @@ -157,7 +157,7 @@ FleeingMovementGenerator::_getPoint(T &owner, float &x, float &y, float &z) y = temp_y; return true; } - float new_z = _map->GetHeight(temp_x, temp_y, z, true); + float new_z = _map->GetHeight(owner.GetPhaseMask(), temp_x, temp_y, z, true); if (new_z <= INVALID_HEIGHT) continue; @@ -169,8 +169,8 @@ FleeingMovementGenerator::_getPoint(T &owner, float &x, float &y, float &z) if (!(new_z - z) || distance / fabs(new_z - z) > 1.0f) { - float new_z_left = _map->GetHeight(temp_x + 1.0f*cos(angle+static_cast(M_PI/2)),temp_y + 1.0f*sin(angle+static_cast(M_PI/2)),z,true); - float new_z_right = _map->GetHeight(temp_x + 1.0f*cos(angle-static_cast(M_PI/2)),temp_y + 1.0f*sin(angle-static_cast(M_PI/2)),z,true); + float new_z_left = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f*cos(angle+static_cast(M_PI/2)),temp_y + 1.0f*sin(angle+static_cast(M_PI/2)),z,true); + float new_z_right = _map->GetHeight(owner.GetPhaseMask(), temp_x + 1.0f*cos(angle-static_cast(M_PI/2)),temp_y + 1.0f*sin(angle-static_cast(M_PI/2)),z,true); if (fabs(new_z_left - new_z) < 1.2f && fabs(new_z_right - new_z) < 1.2f) { x = temp_x; diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp index 0205b734058..7270bbbb688 100755 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp @@ -33,7 +33,7 @@ #endif template<> -void RandomMovementGenerator::_setRandomLocation(Creature &creature) +void RandomMovementGenerator::_setRandomLocation(Creature& creature) { float respX, respY, respZ, respO, currZ, destX, destY, destZ, travelDistZ; creature.GetHomePosition(respX, respY, respZ, respO); @@ -78,17 +78,17 @@ void RandomMovementGenerator::_setRandomLocation(Creature &creature) // The fastest way to get an accurate result 90% of the time. // Better result can be obtained like 99% accuracy with a ray light, but the cost is too high and the code is too long. - destZ = map->GetHeight(destX, destY, respZ+travelDistZ-2.0f, false); + destZ = map->GetHeight(creature.GetPhaseMask(), destX, destY, respZ+travelDistZ-2.0f, false); if (fabs(destZ - respZ) > travelDistZ) // Map check { // Vmap Horizontal or above - destZ = map->GetHeight(destX, destY, respZ - 2.0f, true); + destZ = map->GetHeight(creature.GetPhaseMask(), destX, destY, respZ - 2.0f, true); if (fabs(destZ - respZ) > travelDistZ) { // Vmap Higher - destZ = map->GetHeight(destX, destY, respZ+travelDistZ-2.0f, true); + destZ = map->GetHeight(creature.GetPhaseMask(), destX, destY, respZ+travelDistZ-2.0f, true); // let's forget this bad coords where a z cannot be find and retry at next tick if (fabs(destZ - respZ) > travelDistZ) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 3c73edb880d..042aa68e2a6 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5299,7 +5299,7 @@ SpellCastResult Spell::CheckCast(bool strict) { float x, y, z; m_caster->GetPosition(x, y, z); - float ground_Z = m_caster->GetMap()->GetHeight(x, y, z); + float ground_Z = m_caster->GetMap()->GetHeight(m_caster->GetPhaseMask(), x, y, z); if (fabs(ground_Z - z) < 0.1f) return SPELL_FAILED_DONT_REPORT; break; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 426a93fda57..d87da4cd1a1 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1192,6 +1192,8 @@ void World::LoadConfigSettings(bool reload) sScriptMgr->OnConfigLoad(reload); } +extern void LoadGameObjectModelList(); + /// Initialize the World void World::SetInitialWorldSettings() { @@ -1270,6 +1272,9 @@ void World::SetInitialWorldSettings() sLog->outString("Loading spell custom attributes..."); sSpellMgr->LoadSpellCustomAttr(); + sLog->outString("Loading GameObject models..."); + LoadGameObjectModelList(); + sLog->outString("Loading Script Names..."); sObjectMgr->LoadScriptNames(); diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt index 56e63af5bbf..9195a60dd9d 100644 --- a/src/server/scripts/CMakeLists.txt +++ b/src/server/scripts/CMakeLists.txt @@ -52,6 +52,7 @@ message("") include_directories( ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/dep/g3dlite/include ${CMAKE_SOURCE_DIR}/dep/SFMT ${CMAKE_SOURCE_DIR}/dep/mersennetwister ${CMAKE_SOURCE_DIR}/dep/zlib @@ -69,6 +70,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/server/shared/Utilities ${CMAKE_SOURCE_DIR}/src/server/collision ${CMAKE_SOURCE_DIR}/src/server/collision/Management + ${CMAKE_SOURCE_DIR}/src/server/collision/Models ${CMAKE_SOURCE_DIR}/src/server/shared ${CMAKE_SOURCE_DIR}/src/server/shared/Database ${CMAKE_SOURCE_DIR}/src/server/game/Accounts diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 311c6586a0f..73e6b0ac8a5 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -88,6 +88,7 @@ public: { "update", SEC_ADMINISTRATOR, false, &HandleDebugUpdateCommand, "", NULL }, { "itemexpire", SEC_ADMINISTRATOR, false, &HandleDebugItemExpireCommand, "", NULL }, { "areatriggers", SEC_ADMINISTRATOR, false, &HandleDebugAreaTriggersCommand, "", NULL }, + { "los", SEC_MODERATOR, false, &HandleDebugLoSCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; static ChatCommand commandTable[] = @@ -1040,6 +1041,13 @@ public: handler->GetSession()->GetPlayer()->HandleEmoteCommand(animId); return true; } + + static bool HandleDebugLoSCommand(ChatHandler* handler, char const* args) + { + if (Unit* unit = handler->getSelectedUnit()) + handler->PSendSysMessage("Unit %s (GuidLow: %u) is %sin LoS", unit->GetName(), unit->GetGUIDLow(), handler->GetSession()->GetPlayer()->IsWithinLOSInMap(unit) ? "" : "not "); + return true; + } static bool HandleDebugSetAuraStateCommand(ChatHandler* handler, char const* args) { diff --git a/src/server/scripts/Commands/cs_gps.cpp b/src/server/scripts/Commands/cs_gps.cpp index 8f15f8c9ce3..589ed4af3b8 100644 --- a/src/server/scripts/Commands/cs_gps.cpp +++ b/src/server/scripts/Commands/cs_gps.cpp @@ -87,8 +87,8 @@ public: Map2ZoneCoordinates(zoneX, zoneY, zoneId); Map const* map = object->GetMap(); - float groundZ = map->GetHeight(object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT); - float floorZ = map->GetHeight(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); + float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT); + float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY()); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index 6466780f024..3a96e64697d 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -1200,7 +1200,7 @@ public: float x, y, z; me->GetPosition(x, y, z); - z = me->GetMap()->GetHeight(x, y, z); + z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z); me->SetPosition(x, y, z, 0); } @@ -1319,7 +1319,7 @@ public: { float x, y, z; me->GetPosition(x, y, z); - z = me->GetMap()->GetHeight(x, y, z); + z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z); me->SetPosition(x, y, z, 0); hyjal_trashAI::JustDied(victim); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 94a3da2672b..62b16669152 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -892,7 +892,7 @@ class boss_prince_valanar_icc : public CreatureScript { float x, y, z; summon->GetPosition(x, y, z); - float ground_Z = summon->GetMap()->GetHeight(x, y, z, true, 500.0f); + float ground_Z = summon->GetMap()->GetHeight(summon->GetPhaseMask(), x, y, z, true, 500.0f); summon->GetMotionMaster()->MovePoint(POINT_KINETIC_BOMB_IMPACT, x, y, ground_Z); break; } @@ -1238,7 +1238,7 @@ class npc_kinetic_bomb : public CreatureScript me->SetReactState(REACT_PASSIVE); me->SetSpeed(MOVE_FLIGHT, IsHeroic() ? 0.3f : 0.15f, true); me->GetPosition(_x, _y, _groundZ); - _groundZ = me->GetMap()->GetHeight(_x, _y, _groundZ, true, 500.0f); + _groundZ = me->GetMap()->GetHeight(me->GetPhaseMask(), _x, _y, _groundZ, true, 500.0f); } void DoAction(int32 const action) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index cf22338995b..6eda383e75d 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -948,7 +948,7 @@ class spell_putricide_ooze_summon : public SpellScriptLoader uint32 triggerSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; float x, y, z; GetTarget()->GetPosition(x, y, z); - z = GetTarget()->GetMap()->GetHeight(x, y, z, true, 25.0f); + z = GetTarget()->GetMap()->GetHeight(GetTarget()->GetPhaseMask(), x, y, z, true, 25.0f); x += 10.0f * cosf(caster->GetOrientation()); y += 10.0f * sinf(caster->GetOrientation()); caster->CastSpell(x, y, z, triggerSpellId, true, NULL, NULL, GetCasterGUID()); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 5029dbcceee..6cac58efb42 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -504,7 +504,7 @@ class boss_the_lich_king : public CreatureScript float x, y, z; me->GetPosition(x, y, z); // use larger distance for vmap height search than in most other cases - float ground_Z = me->GetMap()->GetHeight(x, y, z, true, MAX_FALL_DISTANCE); + float ground_Z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z, true, MAX_FALL_DISTANCE); if (fabs(ground_Z - z) < 0.1f) return; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 6bd8f3cba7d..bae1ec36ea8 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1921,7 +1921,7 @@ class spell_svalna_revive_champion : public SpellScriptLoader Position pos; caster->GetPosition(&pos); caster->GetNearPosition(pos, 5.0f, 0.0f); - pos.m_positionZ = caster->GetBaseMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, 20.0f); + pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, 20.0f); pos.m_positionZ += 0.05f; caster->SetHomePosition(pos); caster->GetMotionMaster()->MovePoint(POINT_LAND, pos); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index d96790c3e37..a5adeb18637 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -755,7 +755,7 @@ class boss_flame_leviathan_safety_container : public CreatureScript { float x, y, z; me->GetPosition(x, y, z); - z = me->GetMap()->GetHeight(x, y, z); + z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z); me->GetMotionMaster()->MovePoint(0, x, y, z); me->SetPosition(x, y, z, 0); } diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index 15c7cdb187d..278488eac9e 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -435,7 +435,7 @@ public: float X = CalculateRandomLocation(target->GetPositionX(), 20); float Y = CalculateRandomLocation(target->GetPositionY(), 20); float Z = target->GetPositionZ(); - Z = me->GetMap()->GetHeight(X, Y, Z); + Z = me->GetMap()->GetHeight(me->GetPhaseMask(), X, Y, Z); Creature* DoomBlossom = me->SummonCreature(CREATURE_DOOM_BLOSSOM, X, Y, Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000); if (DoomBlossom) { diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index 191bbbf35b4..b3254fe7a28 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -44,12 +44,14 @@ endif() include_directories( ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/dep/g3dlite/include ${CMAKE_SOURCE_DIR}/dep/gsoap ${CMAKE_SOURCE_DIR}/dep/sockets/include ${CMAKE_SOURCE_DIR}/dep/SFMT ${CMAKE_SOURCE_DIR}/dep/mersennetwister ${CMAKE_SOURCE_DIR}/src/server/collision ${CMAKE_SOURCE_DIR}/src/server/collision/Management + ${CMAKE_SOURCE_DIR}/src/server/collision/Models ${CMAKE_SOURCE_DIR}/src/server/shared ${CMAKE_SOURCE_DIR}/src/server/shared/Configuration ${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography diff --git a/src/tools/vmap3_assembler/CMakeLists.txt b/src/tools/vmap3_assembler/CMakeLists.txt index ba5d1649d38..42ffc749ba8 100644 --- a/src/tools/vmap3_assembler/CMakeLists.txt +++ b/src/tools/vmap3_assembler/CMakeLists.txt @@ -13,6 +13,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/dep/g3dlite/include ${CMAKE_SOURCE_DIR}/src/server/shared ${CMAKE_SOURCE_DIR}/src/server/shared/Debugging + ${CMAKE_SOURCE_DIR}/src/server/collision ${CMAKE_SOURCE_DIR}/src/server/collision/Maps ${CMAKE_SOURCE_DIR}/src/server/collision/Models ${ACE_INCLUDE_DIR} diff --git a/src/tools/vmap3_extractor/adtfile.cpp b/src/tools/vmap3_extractor/adtfile.cpp index 58c1bb94b1c..a966172a3be 100644 --- a/src/tools/vmap3_extractor/adtfile.cpp +++ b/src/tools/vmap3_extractor/adtfile.cpp @@ -1,13 +1,40 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "vmapexport.h" #include "adtfile.h" #include #include -#ifdef _WIN32 +#ifdef WIN32 #define snprintf _snprintf #endif +const char * GetPlainName(const char * FileName) +{ + const char * szTemp; + + if((szTemp = strrchr(FileName, '\\')) != NULL) + FileName = szTemp + 1; + return FileName; +} + char * GetPlainName(char * FileName) { char * szTemp; @@ -43,6 +70,14 @@ void fixname2(char *name, size_t len) } } +char * GetExtension(char * FileName) +{ + char * szTemp; + if((szTemp = strrchr(FileName, '.')) != NULL) + return szTemp; + return NULL; +} + ADTFile::ADTFile(char* filename): ADT(filename) { Adtfilename.append(filename); @@ -107,35 +142,15 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY) while (p= 4 ? path.substr(path.size()-4,4) : ""; - std::transform( ext3.begin(), ext3.end(), ext3.begin(), ::tolower ); - if(ext3 == ".mdx") - { - // replace .mdx -> .m2 - path.erase(path.length()-2,2); - path.append("2"); - } - // >= 3.1.0 ADT MMDX section store filename.m2 filenames for corresponded .m2 file - // nothing do - - char szLocalFile[1024]; - snprintf(szLocalFile, 1024, "%s/%s", szWorkDirWmo, s); - FILE * output = fopen(szLocalFile,"rb"); - if(!output) - { - Model m2(path); - if(m2.open()) - m2.ConvertToVMAPModel(szLocalFile); - } - else - fclose(output); + string path(p); + ExtractSingleModel(path); + + p = p+strlen(p)+1; } delete[] buf; } diff --git a/src/tools/vmap3_extractor/adtfile.h b/src/tools/vmap3_extractor/adtfile.h index eaf09a9243d..08814996f68 100644 --- a/src/tools/vmap3_extractor/adtfile.h +++ b/src/tools/vmap3_extractor/adtfile.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef ADT_H #define ADT_H @@ -115,7 +133,11 @@ private: string Adtfilename; }; +const char * GetPlainName(const char * FileName); +char * GetPlainName(char * FileName); +char * GetExtension(char * FileName); void fixnamen(char *name, size_t len); +void fixname2(char *name, size_t len); //void fixMapNamen(char *name, size_t len); #endif diff --git a/src/tools/vmap3_extractor/dbcfile.cpp b/src/tools/vmap3_extractor/dbcfile.cpp index 8b8afe9f23c..2474cea5259 100644 --- a/src/tools/vmap3_extractor/dbcfile.cpp +++ b/src/tools/vmap3_extractor/dbcfile.cpp @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "dbcfile.h" #include "mpq_libmpq04.h" #undef min diff --git a/src/tools/vmap3_extractor/dbcfile.h b/src/tools/vmap3_extractor/dbcfile.h index d405d6ffd60..56cce9a521c 100644 --- a/src/tools/vmap3_extractor/dbcfile.h +++ b/src/tools/vmap3_extractor/dbcfile.h @@ -1,19 +1,19 @@ /* - * Copyright (C) 2008-2010 TrinityCore - * Copyright (C) 2005-2010 MaNGOS + * Copyright (C) 2005-2011 MaNGOS * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DBCFILE_H diff --git a/src/tools/vmap3_extractor/gameobject_extract.cpp b/src/tools/vmap3_extractor/gameobject_extract.cpp new file mode 100644 index 00000000000..8a1f67cd2c2 --- /dev/null +++ b/src/tools/vmap3_extractor/gameobject_extract.cpp @@ -0,0 +1,99 @@ +#include "model.h" +#include "dbcfile.h" +#include "adtfile.h" +#include "vmapexport.h" + +#include +#include + +bool ExtractSingleModel(std::string& fname) +{ + char * name = GetPlainName((char*)fname.c_str()); + char * ext = GetExtension(name); + + // < 3.1.0 ADT MMDX section store filename.mdx filenames for corresponded .m2 file + if (!strcmp(ext, ".mdx")) + { + // replace .mdx -> .m2 + fname.erase(fname.length()-2,2); + fname.append("2"); + } + // >= 3.1.0 ADT MMDX section store filename.m2 filenames for corresponded .m2 file + // nothing do + + std::string output(szWorkDirWmo); + output += "/"; + output += name; + + if (FileExists(output.c_str())) + return true; + + Model mdl(fname); + if (!mdl.open()) + return false; + + return mdl.ConvertToVMAPModel(output.c_str()); +} + +void ExtractGameobjectModels() +{ + printf("Extracting GameObject models..."); + DBCFile dbc("DBFilesClient\\GameObjectDisplayInfo.dbc"); + if(!dbc.open()) + { + printf("Fatal error: Invalid GameObjectDisplayInfo.dbc file format!\n"); + exit(1); + } + + std::string basepath = szWorkDirWmo; + basepath += "/"; + std::string path; + + FILE * model_list = fopen((basepath + "temp_gameobject_models").c_str(), "wb"); + + for (DBCFile::Iterator it = dbc.begin(); it != dbc.end(); ++it) + { + path = it->getString(1); + + if (path.length() < 4) + continue; + + fixnamen((char*)path.c_str(), path.size()); + char * name = GetPlainName((char*)path.c_str()); + fixname2(name, strlen(name)); + + char * ch_ext = GetExtension(name); + if (!ch_ext) + continue; + + strToLower(ch_ext); + + bool result = false; + if (!strcmp(ch_ext, ".wmo")) + { + result = ExtractSingleWmo(path); + } + else if (!strcmp(ch_ext, ".mdl")) + { + // TODO: extract .mdl files, if needed + continue; + } + else //if (!strcmp(ch_ext, ".mdx") || !strcmp(ch_ext, ".m2")) + { + result = ExtractSingleModel(path); + } + + if (result) + { + uint32 displayId = it->getUInt(0); + uint32 path_length = strlen(name); + fwrite(&displayId, sizeof(uint32), 1, model_list); + fwrite(&path_length, sizeof(uint32), 1, model_list); + fwrite(name, sizeof(char), path_length, model_list); + } + } + + fclose(model_list); + + printf("Done!\n"); +} diff --git a/src/tools/vmap3_extractor/loadlib/loadlib.h b/src/tools/vmap3_extractor/loadlib/loadlib.h index bf6c0706d46..61865c4b436 100644 --- a/src/tools/vmap3_extractor/loadlib/loadlib.h +++ b/src/tools/vmap3_extractor/loadlib/loadlib.h @@ -1,7 +1,25 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef LOAD_LIB_H #define LOAD_LIB_H -#ifdef _WIN32 +#ifdef WIN32 typedef __int64 int64; typedef __int32 int32; typedef __int16 int16; diff --git a/src/tools/vmap3_extractor/model.cpp b/src/tools/vmap3_extractor/model.cpp index 81e27621956..117c594b41a 100644 --- a/src/tools/vmap3_extractor/model.cpp +++ b/src/tools/vmap3_extractor/model.cpp @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "vmapexport.h" #include "model.h" #include "wmo.h" @@ -6,7 +24,7 @@ #include #include -Model::Model(std::string &filename) : filename(filename) +Model::Model(std::string &filename) : filename(filename), vertices(0), indices(0) { } @@ -23,6 +41,8 @@ bool Model::open() return false; } + _unload(); + memcpy(&header, f.getBuffer(), sizeof(ModelHeader)); if(header.nBoundingTriangles > 0) { @@ -49,7 +69,7 @@ bool Model::open() return true; } -bool Model::ConvertToVMAPModel(char * outfilename) +bool Model::ConvertToVMAPModel(const char * outfilename) { int N[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; FILE * output=fopen(outfilename,"wb"); @@ -58,7 +78,7 @@ bool Model::ConvertToVMAPModel(char * outfilename) printf("Can't create the output file '%s'\n",outfilename); return false; } - fwrite("VMAP003",8,1,output); + fwrite(szRawVMAPMagic,8,1,output); uint32 nVertices = 0; nVertices = header.nBoundingVertices; fwrite(&nVertices, sizeof(int), 1, output); @@ -92,24 +112,16 @@ bool Model::ConvertToVMAPModel(char * outfilename) { for(uint32 vpos=0; vpos + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef MODEL_H #define MODEL_H @@ -23,14 +41,21 @@ public: size_t nIndices; bool open(); - bool ConvertToVMAPModel(char * outfilename); + bool ConvertToVMAPModel(const char * outfilename); bool ok; Model(std::string &filename); - ~Model(); + ~Model() {_unload();} private: + void _unload() + { + delete[] vertices; + delete[] indices; + vertices = NULL; + indices = NULL; + } std::string filename; char outfilename; }; diff --git a/src/tools/vmap3_extractor/modelheaders.h b/src/tools/vmap3_extractor/modelheaders.h index 776a981ebd8..d859fd3511e 100644 --- a/src/tools/vmap3_extractor/modelheaders.h +++ b/src/tools/vmap3_extractor/modelheaders.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef MODELHEADERS_H #define MODELHEADERS_H diff --git a/src/tools/vmap3_extractor/mpq_libmpq04.h b/src/tools/vmap3_extractor/mpq_libmpq04.h index f32f09badde..4b0a2465bfd 100644 --- a/src/tools/vmap3_extractor/mpq_libmpq04.h +++ b/src/tools/vmap3_extractor/mpq_libmpq04.h @@ -1,3 +1,6 @@ +#define _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_WARNINGS + #ifndef MPQ_H #define MPQ_H @@ -21,14 +24,14 @@ public: void close(); void GetFileListTo(vector& filelist) { - uint32 filenum; - if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return; - libmpq__off_t size, transferred; - libmpq__file_unpacked_size(mpq_a, filenum, &size); + uint32 filenum; + if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return; + libmpq__off_t size, transferred; + libmpq__file_unpacked_size(mpq_a, filenum, &size); char *buffer = new char[size]; - libmpq__file_read(mpq_a, filenum, (unsigned char*)buffer, size, &transferred); + libmpq__file_read(mpq_a, filenum, (unsigned char*)buffer, size, &transferred); char seps[] = "\n"; char *token; diff --git a/src/tools/vmap3_extractor/vmapexport.cpp b/src/tools/vmap3_extractor/vmapexport.cpp index 689691e1d91..bf5fe1c517f 100644 --- a/src/tools/vmap3_extractor/vmapexport.cpp +++ b/src/tools/vmap3_extractor/vmapexport.cpp @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #define _CRT_SECURE_NO_DEPRECATE #include #include @@ -5,7 +23,7 @@ #include #include -#ifdef _WIN32 +#ifdef WIN32 #include #include #include @@ -29,6 +47,8 @@ #include "wmo.h" #include "mpq_libmpq04.h" +#include "vmapexport.h" + //------------------------------------------------------------------------------ // Defines @@ -55,13 +75,19 @@ bool preciseVectorData = false; // Constants //static const char * szWorkDirMaps = ".\\Maps"; -const char * szWorkDirWmo = "./Buildings"; +const char* szWorkDirWmo = "./Buildings"; +const char* szRawVMAPMagic = "VMAP004"; // Local testing functions -static void clreol() +bool FileExists(const char* file) { - printf("\r \r"); + if (FILE* n = fopen(file, "rb")) + { + fclose(n); + return true; + } + return false; } void strToLower(char* str) @@ -73,15 +99,6 @@ void strToLower(char* str) } } -static const char * GetPlainName(const char * szFileName) -{ - const char * szTemp; - - if((szTemp = strrchr(szFileName, '\\')) != NULL) - szFileName = szTemp + 1; - return szFileName; -} - // copied from contrib/extractor/System.cpp void ReadLiquidTypeTableDBC() { @@ -104,10 +121,9 @@ void ReadLiquidTypeTableDBC() printf("Done! (%u LiqTypes loaded)\n", (unsigned int)LiqType_count); } -int ExtractWmo() +bool ExtractWmo() { - char szLocalFile[1024] = ""; - bool success=true; + bool success = true; //const char* ParsArchiveNames[] = {"patch-2.MPQ", "patch.MPQ", "common.MPQ", "expansion.MPQ"}; @@ -116,99 +132,98 @@ int ExtractWmo() vector filelist; (*ar_itr)->GetFileListTo(filelist); - for (vector::iterator fname=filelist.begin(); fname != filelist.end() && success; ++fname) + for (vector::iterator fname = filelist.begin(); fname != filelist.end() && success; ++fname) { - bool file_ok=true; if (fname->find(".wmo") != string::npos) - { - // Copy files from archive - //std::cout << "found *.wmo file " << *fname << std::endl; - sprintf(szLocalFile, "%s/%s", szWorkDirWmo, GetPlainName(fname->c_str())); - fixnamen(szLocalFile,strlen(szLocalFile)); - FILE * n; - if ((n = fopen(szLocalFile, "rb"))== NULL) - { - int p = 0; - //Select root wmo files - const char * rchr = strrchr(GetPlainName(fname->c_str()),0x5f); - if(rchr != NULL) - { - char cpy[4]; - strncpy((char*)cpy,rchr,4); - for (int i=0;i<4; ++i) - { - int m = cpy[i]; - if(isdigit(m)) - p++; - } - } - if(p != 3) - { - std::cout << "Extracting " << *fname << std::endl; - WMORoot * froot = new WMORoot(*fname); - if(!froot->open()) - { - printf("Couldn't open RootWmo!!!\n"); - delete froot; - continue; - } - FILE *output=fopen(szLocalFile,"wb"); - if(!output) - { - printf("couldn't open %s for writing!\n", szLocalFile); - success=false; - } - froot->ConvertToVMAPRootWmo(output); - int Wmo_nVertices = 0; - //printf("root has %d groups\n", froot->nGroups); - if(froot->nGroups !=0) - { - for (uint32 i=0; inGroups; ++i) - { - char temp[1024]; - strcpy(temp, fname->c_str()); - temp[fname->length()-4] = 0; - char groupFileName[1024]; - sprintf(groupFileName,"%s_%03d.wmo",temp, i); - //printf("Trying to open groupfile %s\n",groupFileName); - string s = groupFileName; - WMOGroup * fgroup = new WMOGroup(s); - if(!fgroup->open()) - { - printf("Could not open all Group file for: %s\n",GetPlainName(fname->c_str())); - file_ok=false; - break; - } - - Wmo_nVertices += fgroup->ConvertToVMAPGroupWmo(output, froot, preciseVectorData); - delete fgroup; - } - } - fseek(output, 8, SEEK_SET); // store the correct no of vertices - fwrite(&Wmo_nVertices,sizeof(int),1,output); - fclose(output); - delete froot; - } - } - else - { - fclose(n); - } - } - // Delete the extracted file in the case of an error - if(!file_ok) - remove(szLocalFile); + success = ExtractSingleWmo(*fname); } } - if(success) + if (success) printf("\nExtract wmo complete (No (fatal) errors)\n"); return success; } -void ExtractMapsFromMpq() +bool ExtractSingleWmo(std::string& fname) { + // Copy files from archive + + char szLocalFile[1024]; + const char * plain_name = GetPlainName(fname.c_str()); + sprintf(szLocalFile, "%s/%s", szWorkDirWmo, plain_name); + fixnamen(szLocalFile,strlen(szLocalFile)); + + if (FileExists(szLocalFile)) + return true; + + int p = 0; + //Select root wmo files + const char * rchr = strrchr(plain_name, '_'); + if(rchr != NULL) + { + char cpy[4]; + strncpy((char*)cpy,rchr,4); + for (int i=0;i < 4; ++i) + { + int m = cpy[i]; + if(isdigit(m)) + p++; + } + } + + if (p == 3) + return true; + + bool file_ok = true; + std::cout << "Extracting " << fname << std::endl; + WMORoot froot(fname); + if(!froot.open()) + { + printf("Couldn't open RootWmo!!!\n"); + return true; + } + FILE *output = fopen(szLocalFile,"wb"); + if(!output) + { + printf("couldn't open %s for writing!\n", szLocalFile); + return false; + } + froot.ConvertToVMAPRootWmo(output); + int Wmo_nVertices = 0; + //printf("root has %d groups\n", froot->nGroups); + if (froot.nGroups !=0) + { + for (uint32 i = 0; i < froot.nGroups; ++i) + { + char temp[1024]; + strcpy(temp, fname.c_str()); + temp[fname.length()-4] = 0; + char groupFileName[1024]; + sprintf(groupFileName,"%s_%03d.wmo",temp, i); + //printf("Trying to open groupfile %s\n",groupFileName); + + string s = groupFileName; + WMOGroup fgroup(s); + if(!fgroup.open()) + { + printf("Could not open all Group file for: %s\n", plain_name); + file_ok = false; + break; + } + + Wmo_nVertices += fgroup.ConvertToVMAPGroupWmo(output, &froot, preciseVectorData); + } + } + + fseek(output, 8, SEEK_SET); // store the correct no of vertices + fwrite(&Wmo_nVertices,sizeof(int),1,output); + fclose(output); + + // Delete the extracted file in the case of an error + if (!file_ok) + remove(szLocalFile); + return true; } void ParsMapFiles() @@ -251,8 +266,9 @@ void getGamePath() LONG l; s = sizeof(input_path); memset(input_path,0,s); - l = RegOpenKeyExA(HKEY_LOCAL_MACHINE,"SOFTWARE\\Blizzard Entertainment\\World of Warcraft",0,KEY_QUERY_VALUE,&key); - l = RegQueryValueExA(key,"InstallPath",0,&t,(LPBYTE)input_path,&s); + l = RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Blizzard Entertainment\\World of Warcraft",0,KEY_QUERY_VALUE,&key); + //l = RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Blizzard Entertainment\\Burning Crusade Closed Beta",0,KEY_QUERY_VALUE,&key); + l = RegQueryValueEx(key,"InstallPath",0,&t,(LPBYTE)input_path,&s); RegCloseKey(key); if (strlen(input_path) > 0) { @@ -379,16 +395,17 @@ bool processArgv(int argc, char ** argv, const char *versionString) { bool result = true; hasInputPathParam = false; + bool preciseVectorData = false; - for (int i=1; i < argc; ++i) + for(int i=1; i< argc; ++i) { - if (strcmp("-s", argv[i]) == 0) + if(strcmp("-s",argv[i]) == 0) { preciseVectorData = false; } - else if (strcmp("-d", argv[i]) == 0) + else if(strcmp("-d",argv[i]) == 0) { - if ((i + 1) < argc) + if((i+1) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef VMAPEXPORT_H #define VMAPEXPORT_H +#include + enum ModelFlags { - MOD_M2 = 1, - MOD_WORLDSPAWN = 1<<1, + MOD_M2 = 1, + MOD_WORLDSPAWN = 1<<1, MOD_HAS_BOUND = 1<<2 }; extern const char * szWorkDirWmo; +extern const char * szRawVMAPMagic; // vmap magic string for extracted raw vmap data + +bool FileExists(const char * file); +void strToLower(char* str); + +bool ExtractSingleWmo(std::string& fname); +bool ExtractSingleModel(std::string& fname); + +void ExtractGameobjectModels(); #endif diff --git a/src/tools/vmap3_extractor/wdtfile.cpp b/src/tools/vmap3_extractor/wdtfile.cpp index cd24ef0346c..e3ee545db19 100644 --- a/src/tools/vmap3_extractor/wdtfile.cpp +++ b/src/tools/vmap3_extractor/wdtfile.cpp @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "vmapexport.h" #include "wdtfile.h" #include "adtfile.h" diff --git a/src/tools/vmap3_extractor/wmo.cpp b/src/tools/vmap3_extractor/wmo.cpp index 216a2248953..58957e007c1 100644 --- a/src/tools/vmap3_extractor/wmo.cpp +++ b/src/tools/vmap3_extractor/wmo.cpp @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "vmapexport.h" #include "wmo.h" #include "vec3d.h" @@ -106,7 +124,7 @@ bool WMORoot::ConvertToVMAPRootWmo(FILE *pOutfile) { //printf("Convert RootWmo...\n"); - fwrite("VMAP003",1,8,pOutfile); + fwrite(szRawVMAPMagic,1,8,pOutfile); unsigned int nVectors = 0; fwrite(&nVectors,sizeof(nVectors),1,pOutfile); // will be filled later fwrite(&nGroups,4,1,pOutfile); diff --git a/src/tools/vmap3_extractor/wmo.h b/src/tools/vmap3_extractor/wmo.h index 12979bc13d9..d1f7b82f0c6 100644 --- a/src/tools/vmap3_extractor/wmo.h +++ b/src/tools/vmap3_extractor/wmo.h @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2005-2011 MaNGOS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef WMO_H #define WMO_H #define TILESIZE (533.33333f) -- cgit v1.2.3 From 9155d21b649589df729b1a5a0f4828678059f7dd Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 10 Feb 2012 16:40:02 +0100 Subject: Scripts/Icecrown Citadel: Fixed crash in spell_frostwarden_handler_order_whelp Closes #5129 --- src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index fb04d9ce7a4..6bbc028e90c 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1344,6 +1344,9 @@ class spell_frostwarden_handler_order_whelp : public SpellScriptLoader ++itr; } + if (unitList.empty()) + return; + Unit* target = SelectRandomContainerElement(unitList); unitList.clear(); unitList.push_back(target); @@ -1356,7 +1359,10 @@ class spell_frostwarden_handler_order_whelp : public SpellScriptLoader std::list unitList; GetCreatureListWithEntryInGrid(unitList, GetCaster(), NPC_FROSTWING_WHELP, 150.0f); if (Creature* creature = GetCaster()->ToCreature()) - unitList.remove_if (OrderWhelpTargetSelector(creature)); + unitList.remove_if(OrderWhelpTargetSelector(creature)); + + if (unitList.empty()) + return; SelectRandomContainerElement(unitList)->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true); } -- cgit v1.2.3 From 05b18ca9ba81c9a6a656e4476e132807489894bf Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 10 Feb 2012 16:44:02 +0100 Subject: Scripts/Icecrown Citadel: Attempt to fix Sindragosa spawning --- .../Northrend/IcecrownCitadel/boss_sindragosa.cpp | 23 ++++++++++++++++++++++ .../IcecrownCitadel/instance_icecrown_citadel.cpp | 4 ---- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 6bbc028e90c..1d9c3c14897 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -597,6 +597,16 @@ class npc_spinestalker : public CreatureScript { } + void InitializeAI() + { + // Increase add count + if (!me->isDead()) + { + _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 1); // this cannot be in Reset because reset also happens on evade + Reset(); + } + } + void Reset() { _events.Reset(); @@ -712,6 +722,16 @@ class npc_rimefang : public CreatureScript { } + void InitializeAI() + { + // Increase add count + if (!me->isDead()) + { + _instance->SetData(DATA_SINDRAGOSA_FROSTWYRMS, 1); // this cannot be in Reset because reset also happens on evade + Reset(); + } + } + void Reset() { _events.Reset(); @@ -860,7 +880,10 @@ class npc_sindragosa_trash : public CreatureScript _frostwyrmId = (me->GetHomePosition().GetPositionY() < 2484.35f) ? DATA_RIMEFANG : DATA_SPINESTALKER; // Increase add count if (!me->isDead()) + { _instance->SetData(_frostwyrmId, 1); // this cannot be in Reset because reset also happens on evade + Reset(); + } } void Reset() diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 2a61d00d119..98f5c04ba42 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -279,13 +279,9 @@ class instance_icecrown_citadel : public InstanceMapScript break; case NPC_SPINESTALKER: SpinestalkerGUID = creature->GetGUID(); - if (!creature->isDead()) - ++FrostwyrmCount; break; case NPC_RIMEFANG: RimefangGUID = creature->GetGUID(); - if (!creature->isDead()) - ++FrostwyrmCount; break; case NPC_THE_LICH_KING: TheLichKingGUID = creature->GetGUID(); -- cgit v1.2.3 From 8a72aede1641ae19d539ed807e3bb0458c7a65e8 Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 14 Feb 2012 12:46:26 -0500 Subject: Codestyle: Renamed some variables to fit codestyle, corrected order in structure/class fields to match alignment (they use slightly less memory now) Signed-off-by: Subv --- src/server/game/AI/EventAI/CreatureEventAI.cpp | 6 +- src/server/game/AI/EventAI/CreatureEventAIMgr.cpp | 6 +- src/server/game/AI/SmartScripts/SmartScript.cpp | 8 +- src/server/game/Conditions/ConditionMgr.cpp | 832 +++++++++++----------- src/server/game/Conditions/ConditionMgr.h | 58 +- src/server/game/Entities/Player/Player.cpp | 172 ++--- src/server/game/Entities/Player/Player.h | 11 +- src/server/game/Entities/Vehicle/VehicleDefines.h | 4 +- src/server/game/Globals/ObjectMgr.cpp | 30 +- src/server/game/Globals/ObjectMgr.h | 18 +- src/server/game/Loot/LootMgr.cpp | 6 +- src/server/game/Maps/Map.cpp | 130 ++-- src/server/game/Maps/Map.h | 75 +- src/server/game/Movement/MotionMaster.cpp | 206 +++--- src/server/game/Movement/MotionMaster.h | 42 +- src/server/game/Quests/QuestDef.h | 18 +- src/server/game/Reputation/ReputationMgr.cpp | 116 +-- src/server/game/Reputation/ReputationMgr.h | 38 +- src/server/game/Scripting/ScriptMgr.cpp | 2 +- src/server/game/Spells/Auras/SpellAuraEffects.h | 7 +- src/server/game/Spells/Auras/SpellAuras.cpp | 36 +- src/server/game/Spells/Auras/SpellAuras.h | 40 +- src/server/game/Spells/Spell.cpp | 4 +- src/server/scripts/Northrend/sholazar_basin.cpp | 4 +- src/server/shared/Database/QueryResult.cpp | 32 +- src/server/shared/Database/QueryResult.h | 26 +- 26 files changed, 964 insertions(+), 963 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp index 9036448d9b4..730606becb5 100755 --- a/src/server/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp @@ -1334,9 +1334,9 @@ void CreatureEventAI::ReceiveEmote(Player* player, uint32 textEmote) return; Condition cond; - cond.mConditionType = ConditionType((*itr).Event.receive_emote.condition); - cond.mConditionValue1 = (*itr).Event.receive_emote.conditionValue1; - cond.mConditionValue2 = (*itr).Event.receive_emote.conditionValue2; + cond.ConditionType = ConditionTypes((*itr).Event.receive_emote.condition); + cond.ConditionValue1 = (*itr).Event.receive_emote.conditionValue1; + cond.ConditionValue2 = (*itr).Event.receive_emote.conditionValue2; ConditionSourceInfo srcInfo = ConditionSourceInfo(player); if (cond.Meets(srcInfo)) diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index 8f2cf6b471f..add7b4db174 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -359,9 +359,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() if (temp.receive_emote.condition) { Condition cond; - cond.mConditionType = ConditionType(temp.receive_emote.condition); - cond.mConditionValue1 = temp.receive_emote.conditionValue1; - cond.mConditionValue2 = temp.receive_emote.conditionValue2; + cond.ConditionType = ConditionTypes(temp.receive_emote.condition); + cond.ConditionValue1 = temp.receive_emote.conditionValue1; + cond.ConditionValue2 = temp.receive_emote.conditionValue2; if (!sConditionMgr->isConditionTypeValid(&cond)) { sLog->outErrorDb("CreatureEventAI: Creature %u using event %u: param2 (Condition: %u) are not valid.", temp.creature_id, i, temp.receive_emote.condition); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 1cf78c4a59c..c716741371e 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2783,10 +2783,10 @@ bool SmartScript::ConditionValid(Unit* u, int32 c, int32 v1, int32 v2, int32 v3) if (c == 0) return true; if (!u || !u->ToPlayer()) return false; Condition cond; - cond.mConditionType = ConditionType(uint32(c)); - cond.mConditionValue1 = uint32(v1); - cond.mConditionValue1 = uint32(v2); - cond.mConditionValue1 = uint32(v3); + cond.ConditionType = ConditionTypes(uint32(c)); + cond.ConditionValue1 = uint32(v1); + cond.ConditionValue1 = uint32(v2); + cond.ConditionValue1 = uint32(v3); ConditionSourceInfo srcInfo = ConditionSourceInfo(u->ToPlayer()); return cond.Meets(srcInfo); } diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 88327a08eec..6130b355119 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -31,17 +31,17 @@ // Can have CONDITION_SOURCE_TYPE_NONE && !mReferenceId if called from a special event (ie: eventAI) bool Condition::Meets(ConditionSourceInfo& sourceInfo) { - ASSERT(mConditionTarget < MAX_CONDITION_TARGETS); - WorldObject* object = sourceInfo.mConditionTargets[mConditionTarget]; + ASSERT(ConditionTarget < MAX_CONDITION_TARGETS); + WorldObject* object = sourceInfo.mConditionTargets[ConditionTarget]; // object not present, return false if (!object) { - sLog->outDebug(LOG_FILTER_CONDITIONSYS, "Condition object not found for condition (Entry: %u Type: %u Group: %u)", mSourceEntry, mSourceType, mSourceGroup); + sLog->outDebug(LOG_FILTER_CONDITIONSYS, "Condition object not found for condition (Entry: %u Type: %u Group: %u)", SourceEntry, SourceType, SourceGroup); return false; } bool condMeets = false; bool sendErrorMsg = false; - switch (mConditionType) + switch (ConditionType) { case CONDITION_NONE: condMeets = true; // empty condition, always met @@ -50,12 +50,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) { if (Unit* unit = object->ToUnit()) { - if (!mConditionValue3) - condMeets = unit->HasAuraEffect(mConditionValue1, mConditionValue2); + if (!ConditionValue3) + condMeets = unit->HasAuraEffect(ConditionValue1, ConditionValue2); else if (Player* player = unit->ToPlayer()) { if (Unit* target = player->GetSelectedUnit()) - condMeets = target->HasAuraEffect(mConditionValue1, mConditionValue2); + condMeets = target->HasAuraEffect(ConditionValue1, ConditionValue2); } } break; @@ -65,72 +65,72 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) if (Player* player = object->ToPlayer()) { // don't allow 0 items (it's checked during table load) - ASSERT(mConditionValue2); - bool checkBank = mConditionValue3 ? true : false; - condMeets = player->HasItemCount(mConditionValue1, mConditionValue2, checkBank); + ASSERT(ConditionValue2); + bool checkBank = ConditionValue3 ? true : false; + condMeets = player->HasItemCount(ConditionValue1, ConditionValue2, checkBank); } break; } case CONDITION_ITEM_EQUIPPED: { if (Player* player = object->ToPlayer()) - condMeets = player->HasItemOrGemWithIdEquipped(mConditionValue1, 1); + condMeets = player->HasItemOrGemWithIdEquipped(ConditionValue1, 1); break; } case CONDITION_ZONEID: - condMeets = object->GetZoneId() == mConditionValue1; + condMeets = object->GetZoneId() == ConditionValue1; break; case CONDITION_REPUTATION_RANK: { if (Player* player = object->ToPlayer()) { - if (FactionEntry const* faction = sFactionStore.LookupEntry(mConditionValue1)) - condMeets = (mConditionValue2 & (1 << player->GetReputationMgr().GetRank(faction))); + if (FactionEntry const* faction = sFactionStore.LookupEntry(ConditionValue1)) + condMeets = (ConditionValue2 & (1 << player->GetReputationMgr().GetRank(faction))); } break; } case CONDITION_ACHIEVEMENT: { if (Player* player = object->ToPlayer()) - condMeets = player->GetAchievementMgr().HasAchieved(mConditionValue1); + condMeets = player->GetAchievementMgr().HasAchieved(ConditionValue1); break; } case CONDITION_TEAM: { if (Player* player = object->ToPlayer()) - condMeets = player->GetTeam() == mConditionValue1; + condMeets = player->GetTeam() == ConditionValue1; break; } case CONDITION_CLASS: { if (Player* player = object->ToPlayer()) - condMeets = player->getClassMask() & mConditionValue1; + condMeets = player->getClassMask() & ConditionValue1; break; } case CONDITION_RACE: { if (Player* player = object->ToPlayer()) - condMeets = player->getRaceMask() & mConditionValue1; + condMeets = player->getRaceMask() & ConditionValue1; break; } case CONDITION_SKILL: { if (Player* player = object->ToPlayer()) - condMeets = player->HasSkill(mConditionValue1) && player->GetBaseSkillValue(mConditionValue1) >= mConditionValue2; + condMeets = player->HasSkill(ConditionValue1) && player->GetBaseSkillValue(ConditionValue1) >= ConditionValue2; break; } case CONDITION_QUESTREWARDED: { if (Player* player = object->ToPlayer()) - condMeets = (player->GetQuestRewardStatus(mConditionValue1) == !mConditionValue2); + condMeets = (player->GetQuestRewardStatus(ConditionValue1) == !ConditionValue2); break; } case CONDITION_QUESTTAKEN: { if (Player* player = object->ToPlayer()) { - QuestStatus status = player->GetQuestStatus(mConditionValue1); - condMeets = ((status == QUEST_STATUS_INCOMPLETE) == !mConditionValue2); + QuestStatus status = player->GetQuestStatus(ConditionValue1); + condMeets = ((status == QUEST_STATUS_INCOMPLETE) == !ConditionValue2); } break; } @@ -138,8 +138,8 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) { if (Player* player = object->ToPlayer()) { - QuestStatus status = player->GetQuestStatus(mConditionValue1); - condMeets = ((status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(mConditionValue1)) == !mConditionValue2); + QuestStatus status = player->GetQuestStatus(ConditionValue1); + condMeets = ((status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(ConditionValue1)) == !ConditionValue2); } break; } @@ -147,19 +147,19 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) { if (Player* player = object->ToPlayer()) { - QuestStatus status = player->GetQuestStatus(mConditionValue1); - condMeets = ((status == QUEST_STATUS_NONE) == !mConditionValue2); + QuestStatus status = player->GetQuestStatus(ConditionValue1); + condMeets = ((status == QUEST_STATUS_NONE) == !ConditionValue2); } break; } case CONDITION_ACTIVE_EVENT: - condMeets = sGameEventMgr->IsActiveEvent(mConditionValue1); + condMeets = sGameEventMgr->IsActiveEvent(ConditionValue1); break; case CONDITION_INSTANCE_DATA: { Map* map = object->GetMap(); if (map && map->IsDungeon() && ((InstanceMap*)map)->GetInstanceScript()) - condMeets = ((InstanceMap*)map)->GetInstanceScript()->GetData(mConditionValue1) == mConditionValue2; + condMeets = ((InstanceMap*)map)->GetInstanceScript()->GetData(ConditionValue1) == ConditionValue2; break; } case CONDITION_SPELL_SCRIPT_TARGET: @@ -172,7 +172,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) Unit* target = player->GetSelectedUnit(); if (target) if (Creature* cTarget = target->ToCreature()) - if (cTarget->GetEntry() == mConditionValue1) + if (cTarget->GetEntry() == ConditionValue1) condMeets = true; } break; @@ -183,7 +183,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) { Unit* target = player->GetSelectedUnit(); if (target) - condMeets = !target->HealthAbovePct(mConditionValue1); + condMeets = !target->HealthAbovePct(ConditionValue1); break; } } @@ -192,16 +192,16 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) if (Player* player = object->ToPlayer()) { if (Unit* target = player->GetSelectedUnit()) - if (player->GetDistance(target) >= mConditionValue1 && (!mConditionValue2 || player->GetDistance(target) <= mConditionValue2)) + if (player->GetDistance(target) >= ConditionValue1 && (!ConditionValue2 || player->GetDistance(target) <= ConditionValue2)) condMeets = true; } break; } case CONDITION_MAPID: - condMeets = object->GetMapId() == mConditionValue1; + condMeets = object->GetMapId() == ConditionValue1; break; case CONDITION_AREAID: - condMeets = object->GetAreaId() == mConditionValue1; + condMeets = object->GetAreaId() == ConditionValue1; break; case CONDITION_ITEM_TARGET: { @@ -211,51 +211,51 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) case CONDITION_SPELL: { if (Player* player = object->ToPlayer()) - condMeets = player->HasSpell(mConditionValue1); + condMeets = player->HasSpell(ConditionValue1); break; } case CONDITION_LEVEL: { if (Unit* unit = object->ToUnit()) - condMeets = CompareValues(static_cast(mConditionValue2), static_cast(unit->getLevel()), mConditionValue1); + condMeets = CompareValues(static_cast(ConditionValue2), static_cast(unit->getLevel()), ConditionValue1); break; } case CONDITION_DRUNKENSTATE: { if (Player* player = object->ToPlayer()) - condMeets = (uint32)Player::GetDrunkenstateByValue(player->GetDrunkValue()) >= mConditionValue1; + condMeets = (uint32)Player::GetDrunkenstateByValue(player->GetDrunkValue()) >= ConditionValue1; break; } case CONDITION_NEAR_CREATURE: { - condMeets = GetClosestCreatureWithEntry(object, mConditionValue1, (float)mConditionValue2) ? true : false; + condMeets = GetClosestCreatureWithEntry(object, ConditionValue1, (float)ConditionValue2) ? true : false; break; } case CONDITION_NEAR_GAMEOBJECT: { - condMeets = GetClosestGameObjectWithEntry(object, mConditionValue1, (float)mConditionValue2) ? true : false; + condMeets = GetClosestGameObjectWithEntry(object, ConditionValue1, (float)ConditionValue2) ? true : false; break; } case CONDITION_OBJECT_ENTRY: { - if (object->GetTypeId() == mConditionValue1) - condMeets = (!mConditionValue2) || (object->GetEntry() == mConditionValue2); + if (object->GetTypeId() == ConditionValue1) + condMeets = (!ConditionValue2) || (object->GetEntry() == ConditionValue2); break; } case CONDITION_TYPE_MASK: { - condMeets = object->isType(mConditionValue1); + condMeets = object->isType(ConditionValue1); break; } case CONDITION_RELATION_TO: { - if (WorldObject* toObject = sourceInfo.mConditionTargets[mConditionValue1]) + if (WorldObject* toObject = sourceInfo.mConditionTargets[ConditionValue1]) { Unit* toUnit = toObject->ToUnit(); Unit* unit = object->ToUnit(); if (toUnit && unit) { - switch (mConditionValue2) + switch (ConditionValue2) { case RELATION_SELF: condMeets = unit == toUnit; @@ -279,19 +279,19 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) } case CONDITION_REACTION_TO: { - if (WorldObject* toObject = sourceInfo.mConditionTargets[mConditionValue1]) + if (WorldObject* toObject = sourceInfo.mConditionTargets[ConditionValue1]) { Unit* toUnit = toObject->ToUnit(); Unit* unit = object->ToUnit(); if (toUnit && unit) - condMeets = (1 << unit->GetReactionTo(toUnit)) & mConditionValue2; + condMeets = (1 << unit->GetReactionTo(toUnit)) & ConditionValue2; } break; } case CONDITION_DISTANCE_TO: { - if (WorldObject* toObject = sourceInfo.mConditionTargets[mConditionValue1]) - condMeets = CompareValues(static_cast(mConditionValue3), object->GetDistance(toObject), static_cast(mConditionValue2)); + if (WorldObject* toObject = sourceInfo.mConditionTargets[ConditionValue1]) + condMeets = CompareValues(static_cast(ConditionValue3), object->GetDistance(toObject), static_cast(ConditionValue2)); break; } case CONDITION_ALIVE: @@ -303,23 +303,23 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) case CONDITION_HP_VAL: { if (Unit* unit = object->ToUnit()) - condMeets = CompareValues(static_cast(mConditionValue2), unit->GetHealth(), static_cast(mConditionValue1)); + condMeets = CompareValues(static_cast(ConditionValue2), unit->GetHealth(), static_cast(ConditionValue1)); break; } case CONDITION_HP_PCT: { if (Unit* unit = object->ToUnit()) - condMeets = CompareValues(static_cast(mConditionValue2), unit->GetHealthPct(), static_cast(mConditionValue1)); + condMeets = CompareValues(static_cast(ConditionValue2), unit->GetHealthPct(), static_cast(ConditionValue1)); break; } case CONDITION_WORLD_STATE: { - condMeets = mConditionValue2 == sWorld->getWorldState(mConditionValue1); + condMeets = ConditionValue2 == sWorld->getWorldState(ConditionValue1); break; } case CONDITION_PHASEMASK: { - condMeets = object->GetPhaseMask() & mConditionValue1; + condMeets = object->GetPhaseMask() & ConditionValue1; break; } default: @@ -327,7 +327,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) break; } - if (mNegativeCondition) + if (NegativeCondition) condMeets = !condMeets; if (!condMeets) @@ -340,7 +340,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) uint32 Condition::GetMaxAvailableConditionTargets() { // returns number of targets which are available for given source type - switch(mSourceType) + switch(SourceType) { case CONDITION_SOURCE_TYPE_SPELL: return 2; @@ -527,21 +527,21 @@ void ConditionMgr::LoadConditions(bool isReload) Condition* cond = new Condition(); int32 iSourceTypeOrReferenceId = fields[0].GetInt32(); - cond->mSourceGroup = fields[1].GetUInt32(); - cond->mSourceEntry = fields[2].GetInt32(); - cond->mSourceId = fields[3].GetUInt32(); - cond->mElseGroup = fields[4].GetUInt32(); + cond->SourceGroup = fields[1].GetUInt32(); + cond->SourceEntry = fields[2].GetInt32(); + cond->SourceId = fields[3].GetUInt32(); + cond->ElseGroup = fields[4].GetUInt32(); int32 iConditionTypeOrReference = fields[5].GetInt32(); - cond->mConditionTarget = fields[6].GetUInt8(); - cond->mConditionValue1 = fields[7].GetUInt32(); - cond->mConditionValue2 = fields[8].GetUInt32(); - cond->mConditionValue3 = fields[9].GetUInt32(); - cond->mNegativeCondition = fields[10].GetUInt8(); - cond->ErrorTextd = fields[11].GetUInt32(); - cond->mScriptId = sObjectMgr->GetScriptId(fields[12].GetCString()); + cond->ConditionTarget = fields[6].GetUInt8(); + cond->ConditionValue1 = fields[7].GetUInt32(); + cond->ConditionValue2 = fields[8].GetUInt32(); + cond->ConditionValue3 = fields[9].GetUInt32(); + cond->NegativeCondition = fields[10].GetUInt8(); + cond->ErrorTextId = fields[11].GetUInt32(); + cond->ScriptId = sObjectMgr->GetScriptId(fields[12].GetCString()); if (iConditionTypeOrReference >= 0) - cond->mConditionType = ConditionType(iConditionTypeOrReference); + cond->ConditionType = ConditionTypes(iConditionTypeOrReference); if (iConditionTypeOrReference < 0)//it has a reference { @@ -551,26 +551,26 @@ void ConditionMgr::LoadConditions(bool isReload) delete cond; continue; } - cond->mReferenceId = uint32(abs(iConditionTypeOrReference)); + cond->ReferenceId = uint32(abs(iConditionTypeOrReference)); const char* rowType = "reference template"; if (iSourceTypeOrReferenceId >= 0) rowType = "reference"; //check for useless data - if (cond->mConditionTarget) - sLog->outErrorDb("Condition %s %i has useless data in ConditionTarget (%u)!", rowType, iSourceTypeOrReferenceId, cond->mConditionTarget); - if (cond->mConditionValue1) - sLog->outErrorDb("Condition %s %i has useless data in value1 (%u)!", rowType, iSourceTypeOrReferenceId, cond->mConditionValue1); - if (cond->mConditionValue2) - sLog->outErrorDb("Condition %s %i has useless data in value2 (%u)!", rowType, iSourceTypeOrReferenceId, cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("Condition %s %i has useless data in value3 (%u)!", rowType, iSourceTypeOrReferenceId, cond->mConditionValue3); - if (cond->mNegativeCondition) - sLog->outErrorDb("Condition %s %i has useless data in NegativeCondition (%u)!", rowType, iSourceTypeOrReferenceId, cond->mNegativeCondition); - if (cond->mSourceGroup && iSourceTypeOrReferenceId < 0) - sLog->outErrorDb("Condition %s %i has useless data in SourceGroup (%u)!", rowType, iSourceTypeOrReferenceId, cond->mSourceGroup); - if (cond->mSourceEntry && iSourceTypeOrReferenceId < 0) - sLog->outErrorDb("Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->mSourceEntry); + if (cond->ConditionTarget) + sLog->outErrorDb("Condition %s %i has useless data in ConditionTarget (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionTarget); + if (cond->ConditionValue1) + sLog->outErrorDb("Condition %s %i has useless data in value1 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue1); + if (cond->ConditionValue2) + sLog->outErrorDb("Condition %s %i has useless data in value2 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("Condition %s %i has useless data in value3 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue3); + if (cond->NegativeCondition) + sLog->outErrorDb("Condition %s %i has useless data in NegativeCondition (%u)!", rowType, iSourceTypeOrReferenceId, cond->NegativeCondition); + if (cond->SourceGroup && iSourceTypeOrReferenceId < 0) + sLog->outErrorDb("Condition %s %i has useless data in SourceGroup (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceGroup); + if (cond->SourceEntry && iSourceTypeOrReferenceId < 0) + sLog->outErrorDb("Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceEntry); } else if (!isConditionTypeValid(cond))//doesn't have reference, validate ConditionType { @@ -591,7 +591,7 @@ void ConditionMgr::LoadConditions(bool isReload) continue; }//end of reference templates - cond->mSourceType = ConditionSourceType(iSourceTypeOrReferenceId); + cond->SourceType = ConditionSourceType(iSourceTypeOrReferenceId); //if not a reference and SourceType is invalid, skip if (iConditionTypeOrReference >= 0 && !isSourceTypeValid(cond)) @@ -601,53 +601,53 @@ void ConditionMgr::LoadConditions(bool isReload) } //Grouping is only allowed for some types (loot templates, gossip menus, gossip items) - if (cond->mSourceGroup && !isGroupable(cond->mSourceType)) + if (cond->SourceGroup && !isGroupable(cond->SourceType)) { - sLog->outErrorDb("Condition type %u has not allowed grouping %u!", uint32(cond->mSourceType), cond->mSourceGroup); + sLog->outErrorDb("Condition type %u has not allowed grouping %u!", uint32(cond->SourceType), cond->SourceGroup); delete cond; continue; } - else if (cond->mSourceGroup) + else if (cond->SourceGroup) { bool valid = false; //handle grouped conditions - switch (cond->mSourceType) + switch (cond->SourceType) { case CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE: - valid = addToLootTemplate(cond, LootTemplates_Creature.GetLootForConditionFill(cond->mSourceGroup)); + valid = addToLootTemplate(cond, LootTemplates_Creature.GetLootForConditionFill(cond->SourceGroup)); break; case CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE: - valid = addToLootTemplate(cond, LootTemplates_Disenchant.GetLootForConditionFill(cond->mSourceGroup)); + valid = addToLootTemplate(cond, LootTemplates_Disenchant.GetLootForConditionFill(cond->SourceGroup)); break; case CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE: - valid = addToLootTemplate(cond, LootTemplates_Fishing.GetLootForConditionFill(cond->mSourceGroup)); + valid = addToLootTemplate(cond, LootTemplates_Fishing.GetLootForConditionFill(cond->SourceGroup)); break; case CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE: - valid = addToLootTemplate(cond, LootTemplates_Gameobject.GetLootForConditionFill(cond->mSourceGroup)); + valid = addToLootTemplate(cond, LootTemplates_Gameobject.GetLootForConditionFill(cond->SourceGroup)); break; case CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE: - valid = addToLootTemplate(cond, LootTemplates_Item.GetLootForConditionFill(cond->mSourceGroup)); + valid = addToLootTemplate(cond, LootTemplates_Item.GetLootForConditionFill(cond->SourceGroup)); break; case CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE: - valid = addToLootTemplate(cond, LootTemplates_Mail.GetLootForConditionFill(cond->mSourceGroup)); + valid = addToLootTemplate(cond, LootTemplates_Mail.GetLootForConditionFill(cond->SourceGroup)); break; case CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE: - valid = addToLootTemplate(cond, LootTemplates_Milling.GetLootForConditionFill(cond->mSourceGroup)); + valid = addToLootTemplate(cond, LootTemplates_Milling.GetLootForConditionFill(cond->SourceGroup)); break; case CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE: - valid = addToLootTemplate(cond, LootTemplates_Pickpocketing.GetLootForConditionFill(cond->mSourceGroup)); + valid = addToLootTemplate(cond, LootTemplates_Pickpocketing.GetLootForConditionFill(cond->SourceGroup)); break; case CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE: - valid = addToLootTemplate(cond, LootTemplates_Prospecting.GetLootForConditionFill(cond->mSourceGroup)); + valid = addToLootTemplate(cond, LootTemplates_Prospecting.GetLootForConditionFill(cond->SourceGroup)); break; case CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE: - valid = addToLootTemplate(cond, LootTemplates_Reference.GetLootForConditionFill(cond->mSourceGroup)); + valid = addToLootTemplate(cond, LootTemplates_Reference.GetLootForConditionFill(cond->SourceGroup)); break; case CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE: - valid = addToLootTemplate(cond, LootTemplates_Skinning.GetLootForConditionFill(cond->mSourceGroup)); + valid = addToLootTemplate(cond, LootTemplates_Skinning.GetLootForConditionFill(cond->SourceGroup)); break; case CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE: - valid = addToLootTemplate(cond, LootTemplates_Spell.GetLootForConditionFill(cond->mSourceGroup)); + valid = addToLootTemplate(cond, LootTemplates_Spell.GetLootForConditionFill(cond->SourceGroup)); break; case CONDITION_SOURCE_TYPE_GOSSIP_MENU: valid = addToGossipMenus(cond); @@ -658,18 +658,18 @@ void ConditionMgr::LoadConditions(bool isReload) case CONDITION_SOURCE_TYPE_VEHICLE_SPELL: { //if no list for vehicle create one - if (VehicleSpellConditionStore.find(cond->mSourceGroup) == VehicleSpellConditionStore.end()) + if (VehicleSpellConditionStore.find(cond->SourceGroup) == VehicleSpellConditionStore.end()) { ConditionTypeContainer cmap; - VehicleSpellConditionStore[cond->mSourceGroup] = cmap; + VehicleSpellConditionStore[cond->SourceGroup] = cmap; } //if no list for vehicle's spell create one - if (VehicleSpellConditionStore[cond->mSourceGroup].find(cond->mSourceEntry) == VehicleSpellConditionStore[cond->mSourceGroup].end()) + if (VehicleSpellConditionStore[cond->SourceGroup].find(cond->SourceEntry) == VehicleSpellConditionStore[cond->SourceGroup].end()) { ConditionList clist; - VehicleSpellConditionStore[cond->mSourceGroup][cond->mSourceEntry] = clist; + VehicleSpellConditionStore[cond->SourceGroup][cond->SourceEntry] = clist; } - VehicleSpellConditionStore[cond->mSourceGroup][cond->mSourceEntry].push_back(cond); + VehicleSpellConditionStore[cond->SourceGroup][cond->SourceEntry].push_back(cond); valid = true; ++count; continue; // do not add to m_AllocatedMemory to avoid double deleting @@ -677,18 +677,18 @@ void ConditionMgr::LoadConditions(bool isReload) case CONDITION_SOURCE_TYPE_SMART_EVENT: { // If the entry does not exist, create a new list - std::pair key = std::make_pair(cond->mSourceEntry, cond->mSourceId); + std::pair key = std::make_pair(cond->SourceEntry, cond->SourceId); if (SmartEventConditionStore.find(key) == SmartEventConditionStore.end()) { ConditionTypeContainer cmap; SmartEventConditionStore[key] = cmap; } - if (SmartEventConditionStore[key].find(cond->mSourceGroup) == SmartEventConditionStore[key].end()) + if (SmartEventConditionStore[key].find(cond->SourceGroup) == SmartEventConditionStore[key].end()) { ConditionList clist; - SmartEventConditionStore[key][cond->mSourceGroup] = clist; + SmartEventConditionStore[key][cond->SourceGroup] = clist; } - SmartEventConditionStore[key][cond->mSourceGroup].push_back(cond); + SmartEventConditionStore[key][cond->SourceGroup].push_back(cond); valid = true; ++count; continue; @@ -699,7 +699,7 @@ void ConditionMgr::LoadConditions(bool isReload) if (!valid) { - sLog->outErrorDb("Not handled grouped condition, SourceGroup %u", cond->mSourceGroup); + sLog->outErrorDb("Not handled grouped condition, SourceGroup %u", cond->SourceGroup); delete cond; } else @@ -712,21 +712,21 @@ void ConditionMgr::LoadConditions(bool isReload) //handle not grouped conditions //make sure we have a storage list for our SourceType - if (ConditionStore.find(cond->mSourceType) == ConditionStore.end()) + if (ConditionStore.find(cond->SourceType) == ConditionStore.end()) { ConditionTypeContainer mTypeMap; - ConditionStore[cond->mSourceType] = mTypeMap;//add new empty list for SourceType + ConditionStore[cond->SourceType] = mTypeMap;//add new empty list for SourceType } //make sure we have a condition list for our SourceType's entry - if (ConditionStore[cond->mSourceType].find(cond->mSourceEntry) == ConditionStore[cond->mSourceType].end()) + if (ConditionStore[cond->SourceType].find(cond->SourceEntry) == ConditionStore[cond->SourceType].end()) { ConditionList mCondList; - ConditionStore[cond->mSourceType][cond->mSourceEntry] = mCondList; + ConditionStore[cond->SourceType][cond->SourceEntry] = mCondList; } //add new Condition to storage based on Type/Entry - ConditionStore[cond->mSourceType][cond->mSourceEntry].push_back(cond); + ConditionStore[cond->SourceType][cond->SourceEntry].push_back(cond); ++count; } while (result->NextRow()); @@ -739,26 +739,26 @@ bool ConditionMgr::addToLootTemplate(Condition* cond, LootTemplate* loot) { if (!loot) { - sLog->outErrorDb("ConditionMgr: LootTemplate %u not found", cond->mSourceGroup); + sLog->outErrorDb("ConditionMgr: LootTemplate %u not found", cond->SourceGroup); return false; } if (loot->addConditionItem(cond)) return true; - sLog->outErrorDb("ConditionMgr: Item %u not found in LootTemplate %u", cond->mSourceEntry, cond->mSourceGroup); + sLog->outErrorDb("ConditionMgr: Item %u not found in LootTemplate %u", cond->SourceEntry, cond->SourceGroup); return false; } bool ConditionMgr::addToGossipMenus(Condition* cond) { - GossipMenusMapBoundsNonConst pMenuBounds = sObjectMgr->GetGossipMenusMapBoundsNonConst(cond->mSourceGroup); + GossipMenusMapBoundsNonConst pMenuBounds = sObjectMgr->GetGossipMenusMapBoundsNonConst(cond->SourceGroup); if (pMenuBounds.first != pMenuBounds.second) { for (GossipMenusContainer::iterator itr = pMenuBounds.first; itr != pMenuBounds.second; ++itr) { - if ((*itr).second.entry == cond->mSourceGroup && (*itr).second.text_id == cond->mSourceEntry) + if ((*itr).second.entry == cond->SourceGroup && (*itr).second.text_id == cond->SourceEntry) { (*itr).second.conditions.push_back(cond); return true; @@ -766,18 +766,18 @@ bool ConditionMgr::addToGossipMenus(Condition* cond) } } - sLog->outErrorDb("addToGossipMenus: GossipMenu %u not found", cond->mSourceGroup); + sLog->outErrorDb("addToGossipMenus: GossipMenu %u not found", cond->SourceGroup); return false; } bool ConditionMgr::addToGossipMenuItems(Condition* cond) { - GossipMenuItemsMapBoundsNonConst pMenuItemBounds = sObjectMgr->GetGossipMenuItemsMapBoundsNonConst(cond->mSourceGroup); + GossipMenuItemsMapBoundsNonConst pMenuItemBounds = sObjectMgr->GetGossipMenuItemsMapBoundsNonConst(cond->SourceGroup); if (pMenuItemBounds.first != pMenuItemBounds.second) { for (GossipMenuItemsContainer::iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr) { - if ((*itr).second.MenuId == cond->mSourceGroup && (*itr).second.OptionIndex == cond->mSourceEntry) + if ((*itr).second.MenuId == cond->SourceGroup && (*itr).second.OptionIndex == cond->SourceEntry) { (*itr).second.Conditions.push_back(cond); return true; @@ -785,236 +785,236 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond) } } - sLog->outErrorDb("addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->mSourceGroup, cond->mSourceEntry); + sLog->outErrorDb("addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->SourceGroup, cond->SourceEntry); return false; } bool ConditionMgr::isSourceTypeValid(Condition* cond) { - if (cond->mSourceType == CONDITION_SOURCE_TYPE_NONE || cond->mSourceType >= CONDITION_SOURCE_TYPE_MAX) + if (cond->SourceType == CONDITION_SOURCE_TYPE_NONE || cond->SourceType >= CONDITION_SOURCE_TYPE_MAX) { - sLog->outErrorDb("Invalid ConditionSourceType %u in `condition` table, ignoring.", uint32(cond->mSourceType)); + sLog->outErrorDb("Invalid ConditionSourceType %u in `condition` table, ignoring.", uint32(cond->SourceType)); return false; } - switch (cond->mSourceType) + switch (cond->SourceType) { case CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE: { - if (!LootTemplates_Creature.HaveLootFor(cond->mSourceGroup)) + if (!LootTemplates_Creature.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond->mSourceGroup); + sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond->SourceGroup); return false; } - LootTemplate* loot = LootTemplates_Creature.GetLootForConditionFill(cond->mSourceGroup); - ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); - if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + LootTemplate* loot = LootTemplates_Creature.GetLootForConditionFill(cond->SourceGroup); + ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); + if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE: { - if (!LootTemplates_Disenchant.HaveLootFor(cond->mSourceGroup)) + if (!LootTemplates_Disenchant.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond->mSourceGroup); + sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond->SourceGroup); return false; } - LootTemplate* loot = LootTemplates_Disenchant.GetLootForConditionFill(cond->mSourceGroup); - ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); - if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + LootTemplate* loot = LootTemplates_Disenchant.GetLootForConditionFill(cond->SourceGroup); + ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); + if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE: { - if (!LootTemplates_Fishing.HaveLootFor(cond->mSourceGroup)) + if (!LootTemplates_Fishing.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond->mSourceGroup); + sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond->SourceGroup); return false; } - LootTemplate* loot = LootTemplates_Fishing.GetLootForConditionFill(cond->mSourceGroup); - ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); - if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + LootTemplate* loot = LootTemplates_Fishing.GetLootForConditionFill(cond->SourceGroup); + ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); + if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE: { - if (!LootTemplates_Gameobject.HaveLootFor(cond->mSourceGroup)) + if (!LootTemplates_Gameobject.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->mSourceGroup); + sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->SourceGroup); return false; } - LootTemplate* loot = LootTemplates_Gameobject.GetLootForConditionFill(cond->mSourceGroup); - ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); - if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + LootTemplate* loot = LootTemplates_Gameobject.GetLootForConditionFill(cond->SourceGroup); + ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); + if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE: { - if (!LootTemplates_Item.HaveLootFor(cond->mSourceGroup)) + if (!LootTemplates_Item.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->mSourceGroup); + sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->SourceGroup); return false; } - LootTemplate* loot = LootTemplates_Item.GetLootForConditionFill(cond->mSourceGroup); - ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); - if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + LootTemplate* loot = LootTemplates_Item.GetLootForConditionFill(cond->SourceGroup); + ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); + if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE: { - if (!LootTemplates_Mail.HaveLootFor(cond->mSourceGroup)) + if (!LootTemplates_Mail.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond->mSourceGroup); + sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond->SourceGroup); return false; } - LootTemplate* loot = LootTemplates_Mail.GetLootForConditionFill(cond->mSourceGroup); - ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); - if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + LootTemplate* loot = LootTemplates_Mail.GetLootForConditionFill(cond->SourceGroup); + ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); + if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE: { - if (!LootTemplates_Milling.HaveLootFor(cond->mSourceGroup)) + if (!LootTemplates_Milling.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond->mSourceGroup); + sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond->SourceGroup); return false; } - LootTemplate* loot = LootTemplates_Milling.GetLootForConditionFill(cond->mSourceGroup); - ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); - if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + LootTemplate* loot = LootTemplates_Milling.GetLootForConditionFill(cond->SourceGroup); + ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); + if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE: { - if (!LootTemplates_Pickpocketing.HaveLootFor(cond->mSourceGroup)) + if (!LootTemplates_Pickpocketing.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond->mSourceGroup); + sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond->SourceGroup); return false; } - LootTemplate* loot = LootTemplates_Pickpocketing.GetLootForConditionFill(cond->mSourceGroup); - ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); - if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + LootTemplate* loot = LootTemplates_Pickpocketing.GetLootForConditionFill(cond->SourceGroup); + ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); + if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE: { - if (!LootTemplates_Prospecting.HaveLootFor(cond->mSourceGroup)) + if (!LootTemplates_Prospecting.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond->mSourceGroup); + sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond->SourceGroup); return false; } - LootTemplate* loot = LootTemplates_Prospecting.GetLootForConditionFill(cond->mSourceGroup); - ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); - if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + LootTemplate* loot = LootTemplates_Prospecting.GetLootForConditionFill(cond->SourceGroup); + ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); + if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE: { - if (!LootTemplates_Reference.HaveLootFor(cond->mSourceGroup)) + if (!LootTemplates_Reference.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond->mSourceGroup); + sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond->SourceGroup); return false; } - LootTemplate* loot = LootTemplates_Reference.GetLootForConditionFill(cond->mSourceGroup); - ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); - if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + LootTemplate* loot = LootTemplates_Reference.GetLootForConditionFill(cond->SourceGroup); + ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); + if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE: { - if (!LootTemplates_Skinning.HaveLootFor(cond->mSourceGroup)) + if (!LootTemplates_Skinning.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond->mSourceGroup); + sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond->SourceGroup); return false; } - LootTemplate* loot = LootTemplates_Skinning.GetLootForConditionFill(cond->mSourceGroup); - ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); - if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + LootTemplate* loot = LootTemplates_Skinning.GetLootForConditionFill(cond->SourceGroup); + ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); + if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE: { - if (!LootTemplates_Spell.HaveLootFor(cond->mSourceGroup)) + if (!LootTemplates_Spell.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond->mSourceGroup); + sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond->SourceGroup); return false; } - LootTemplate* loot = LootTemplates_Spell.GetLootForConditionFill(cond->mSourceGroup); - ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); - if (!pItemProto && !loot->isReference(cond->mSourceEntry)) + LootTemplate* loot = LootTemplates_Spell.GetLootForConditionFill(cond->SourceGroup); + ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); + if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->mSourceType, cond->mSourceEntry); + sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET: { - if (cond->mConditionType != CONDITION_SPELL_SCRIPT_TARGET) + if (cond->ConditionType != CONDITION_SPELL_SCRIPT_TARGET) { - sLog->outErrorDb("SourceEntry %u in `condition` table, has ConditionType %u. Only CONDITION_SPELL_SCRIPT_TARGET(18) is valid for CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET(14), ignoring.", cond->mSourceEntry, uint32(cond->mConditionType)); + sLog->outErrorDb("SourceEntry %u in `condition` table, has ConditionType %u. Only CONDITION_SPELL_SCRIPT_TARGET(18) is valid for CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET(14), ignoring.", cond->SourceEntry, uint32(cond->ConditionType)); return false; } - SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->mSourceEntry); + SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->SourceEntry); if (!spellProto) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->mSourceEntry); + sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } @@ -1041,59 +1041,59 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) targetfound = true; //break; } - else if (cond->mConditionValue3 & (1 << i)) + else if (cond->ConditionValue3 & (1 << i)) { - cond->mConditionValue3 &= ~(1 << i); + cond->ConditionValue3 &= ~(1 << i); sLog->outErrorDb("SourceEntry %u in `condition` table does not have any implicit target TARGET_UNIT_NEARBY_ENTRY(38) or TARGET_DEST_NEARBY_ENTRY (46)" ", TARGET_UNIT_SRC_AREA_ENTRY(7), TARGET_UNIT_DEST_AREA_ENTRY(8), TARGET_UNIT_CONE_ENTRY(60), TARGET_GAMEOBJECT_NEARBY_ENTRY(40)" - "TARGET_GAMEOBJECT_SRC_AREA(51), TARGET_GAMEOBJECT_DEST_AREA(52) in effect %u", cond->mSourceEntry, uint32(i)); + "TARGET_GAMEOBJECT_SRC_AREA(51), TARGET_GAMEOBJECT_DEST_AREA(52) in effect %u", cond->SourceEntry, uint32(i)); } } - if (!targetfound && !cond->mConditionValue3) // cond->mConditionValue3 already errored up there + if (!targetfound && !cond->ConditionValue3) // cond->mConditionValue3 already errored up there { sLog->outErrorDb("SourceEntry %u in `condition` table does not have any implicit target TARGET_UNIT_NEARBY_ENTRY(38) or TARGET_DEST_NEARBY_ENTRY (46)" ", TARGET_UNIT_SRC_AREA_ENTRY(7), TARGET_UNIT_DEST_AREA_ENTRY(8), TARGET_UNIT_CONE_ENTRY(60), TARGET_GAMEOBJECT_NEARBY_ENTRY(40)" - "TARGET_GAMEOBJECT_SRC_AREA(51), TARGET_GAMEOBJECT_DEST_AREA(52)", cond->mSourceEntry); + "TARGET_GAMEOBJECT_SRC_AREA(51), TARGET_GAMEOBJECT_DEST_AREA(52)", cond->SourceEntry); return false; } - if ((cond->mConditionValue1 == SPELL_TARGET_TYPE_DEAD) && !spellProto->IsAllowingDeadTarget()) + if ((cond->ConditionValue1 == SPELL_TARGET_TYPE_DEAD) && !spellProto->IsAllowingDeadTarget()) { - sLog->outErrorDb("SourceEntry %u in `condition` table does have SPELL_TARGET_TYPE_DEAD specified but spell does not have SPELL_ATTR2_CAN_TARGET_DEAD", cond->mSourceEntry); + sLog->outErrorDb("SourceEntry %u in `condition` table does have SPELL_TARGET_TYPE_DEAD specified but spell does not have SPELL_ATTR2_CAN_TARGET_DEAD", cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE: { - if (!sObjectMgr->GetCreatureTemplate(cond->mSourceEntry)) + if (!sObjectMgr->GetCreatureTemplate(cond->SourceEntry)) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->mSourceEntry); + sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_SPELL: { - SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->mSourceEntry); + SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->SourceEntry); if (!spellProto) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->mSourceEntry); + sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } break; } case CONDITION_SOURCE_TYPE_ITEM_REQUIRED_TARGET: { - if (cond->mConditionType != CONDITION_ITEM_TARGET) + if (cond->ConditionType != CONDITION_ITEM_TARGET) { - sLog->outErrorDb("SourceEntry %u in `condition` table, has ConditionType %u. Only CONDITION_ITEM_TARGET(24) is valid for CONDITION_SOURCE_TYPE_ITEM_REQUIRED_TARGET(18), ignoring.", cond->mSourceEntry, uint32(cond->mConditionType)); + sLog->outErrorDb("SourceEntry %u in `condition` table, has ConditionType %u. Only CONDITION_ITEM_TARGET(24) is valid for CONDITION_SOURCE_TYPE_ITEM_REQUIRED_TARGET(18), ignoring.", cond->SourceEntry, uint32(cond->ConditionType)); return false; } - ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); + ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `item_tamplate`, ignoring.", cond->mSourceEntry); + sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `item_tamplate`, ignoring.", cond->SourceEntry); return false; } @@ -1121,35 +1121,35 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) if (!bIsItemSpellValid) { sLog->outErrorDb("Conditions: CONDITION_SOURCE_TYPE_ITEM_REQUIRED_TARGET for item %u, which either doesn't have item spelltrigger or its spells don't allow caster to select a unit target" - ", or the spells are already listed in CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET conditions.", cond->mSourceEntry); + ", or the spells are already listed in CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET conditions.", cond->SourceEntry); break; } break; } case CONDITION_SOURCE_TYPE_QUEST_ACCEPT: - if (!sObjectMgr->GetQuestTemplate(cond->mSourceEntry)) + if (!sObjectMgr->GetQuestTemplate(cond->SourceEntry)) { - sLog->outErrorDb("CONDITION_SOURCE_TYPE_QUEST_ACCEPT specifies non-existing quest (%u), skipped", cond->mSourceEntry); + sLog->outErrorDb("CONDITION_SOURCE_TYPE_QUEST_ACCEPT specifies non-existing quest (%u), skipped", cond->SourceEntry); return false; } break; case CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK: - if (!sObjectMgr->GetQuestTemplate(cond->mSourceEntry)) + if (!sObjectMgr->GetQuestTemplate(cond->SourceEntry)) { - sLog->outErrorDb("CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK specifies non-existing quest (%u), skipped", cond->mSourceEntry); + sLog->outErrorDb("CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK specifies non-existing quest (%u), skipped", cond->SourceEntry); return false; } break; case CONDITION_SOURCE_TYPE_VEHICLE_SPELL: - if (!sObjectMgr->GetCreatureTemplate(cond->mSourceGroup)) + if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup)) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->mSourceGroup); + sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); return false; } - if (!sSpellMgr->GetSpellInfo(cond->mSourceEntry)) + if (!sSpellMgr->GetSpellInfo(cond->SourceEntry)) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->mSourceEntry); + sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } break; @@ -1165,129 +1165,129 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) } bool ConditionMgr::isConditionTypeValid(Condition* cond) { - if (cond->mConditionType == CONDITION_NONE || cond->mConditionType >= CONDITION_MAX) + if (cond->ConditionType == CONDITION_NONE || cond->ConditionType >= CONDITION_MAX) { - sLog->outErrorDb("Invalid ConditionType %u at SourceEntry %u in `condition` table, ignoring.", uint32(cond->mConditionType), cond->mSourceEntry); + sLog->outErrorDb("Invalid ConditionType %u at SourceEntry %u in `condition` table, ignoring.", uint32(cond->ConditionType), cond->SourceEntry); return false; } - if (cond->mConditionTarget >= cond->GetMaxAvailableConditionTargets()) + if (cond->ConditionTarget >= cond->GetMaxAvailableConditionTargets()) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->mSourceType, cond->mSourceEntry); + sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->SourceType, cond->SourceEntry); return false; } - switch (cond->mConditionType) + switch (cond->ConditionType) { case CONDITION_AURA: { - if (!sSpellMgr->GetSpellInfo(cond->mConditionValue1)) + if (!sSpellMgr->GetSpellInfo(cond->ConditionValue1)) { - sLog->outErrorDb("Aura condition has non existing spell (Id: %d), skipped", cond->mConditionValue1); + sLog->outErrorDb("Aura condition has non existing spell (Id: %d), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2 > 2) + if (cond->ConditionValue2 > 2) { - sLog->outErrorDb("Aura condition has non existing effect index (%u) (must be 0..2), skipped", cond->mConditionValue2); + sLog->outErrorDb("Aura condition has non existing effect index (%u) (must be 0..2), skipped", cond->ConditionValue2); return false; } break; } case CONDITION_ITEM: { - ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->mConditionValue1); + ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->ConditionValue1); if (!proto) { - sLog->outErrorDb("Item condition has non existing item (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("Item condition has non existing item (%u), skipped", cond->ConditionValue1); return false; } - if (!cond->mConditionValue2) + if (!cond->ConditionValue2) { - sLog->outErrorDb("Item condition has 0 set for item count in value2 (%u), skipped", cond->mConditionValue2); + sLog->outErrorDb("Item condition has 0 set for item count in value2 (%u), skipped", cond->ConditionValue2); return false; } break; } case CONDITION_ITEM_EQUIPPED: { - ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->mConditionValue1); + ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->ConditionValue1); if (!proto) { - sLog->outErrorDb("ItemEquipped condition has non existing item (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("ItemEquipped condition has non existing item (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2) - sLog->outErrorDb("ItemEquipped condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("ItemEquipped condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue2) + sLog->outErrorDb("ItemEquipped condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("ItemEquipped condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ZONEID: { - AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(cond->mConditionValue1); + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(cond->ConditionValue1); if (!areaEntry) { - sLog->outErrorDb("ZoneID condition has non existing area (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("ZoneID condition has non existing area (%u), skipped", cond->ConditionValue1); return false; } if (areaEntry->zone != 0) { - sLog->outErrorDb("ZoneID condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->mConditionValue1); + sLog->outErrorDb("ZoneID condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2) - sLog->outErrorDb("ZoneID condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("ZoneID condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue2) + sLog->outErrorDb("ZoneID condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("ZoneID condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_REPUTATION_RANK: { - FactionEntry const* factionEntry = sFactionStore.LookupEntry(cond->mConditionValue1); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(cond->ConditionValue1); if (!factionEntry) { - sLog->outErrorDb("Reputation condition has non existing faction (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("Reputation condition has non existing faction (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue3) - sLog->outErrorDb("Reputation condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue3) + sLog->outErrorDb("Reputation condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_TEAM: { - if (cond->mConditionValue1 != ALLIANCE && cond->mConditionValue1 != HORDE) + if (cond->ConditionValue1 != ALLIANCE && cond->ConditionValue1 != HORDE) { - sLog->outErrorDb("Team condition specifies unknown team (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("Team condition specifies unknown team (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2) - sLog->outErrorDb("Team condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("Team condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue2) + sLog->outErrorDb("Team condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("Team condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_SKILL: { - SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(cond->mConditionValue1); + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(cond->ConditionValue1); if (!pSkill) { - sLog->outErrorDb("Skill condition specifies non-existing skill (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("Skill condition specifies non-existing skill (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2 < 1 || cond->mConditionValue2 > sWorld->GetConfigMaxSkillValue()) + if (cond->ConditionValue2 < 1 || cond->ConditionValue2 > sWorld->GetConfigMaxSkillValue()) { - sLog->outErrorDb("Skill condition specifies invalid skill value (%u), skipped", cond->mConditionValue2); + sLog->outErrorDb("Skill condition specifies invalid skill value (%u), skipped", cond->ConditionValue2); return false; } - if (cond->mConditionValue3) - sLog->outErrorDb("Skill condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue3) + sLog->outErrorDb("Skill condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_QUESTREWARDED: @@ -1295,91 +1295,91 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) case CONDITION_QUEST_NONE: case CONDITION_QUEST_COMPLETE: { - if (!sObjectMgr->GetQuestTemplate(cond->mConditionValue1)) + if (!sObjectMgr->GetQuestTemplate(cond->ConditionValue1)) { - sLog->outErrorDb("Quest condition specifies non-existing quest (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("Quest condition specifies non-existing quest (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2 > 1) - sLog->outErrorDb("Quest condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("Quest condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue2 > 1) + sLog->outErrorDb("Quest condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("Quest condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ACTIVE_EVENT: { GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); - if (cond->mConditionValue1 >=events.size() || !events[cond->mConditionValue1].isValid()) + if (cond->ConditionValue1 >=events.size() || !events[cond->ConditionValue1].isValid()) { - sLog->outErrorDb("ActiveEvent condition has non existing event id (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("ActiveEvent condition has non existing event id (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2) - sLog->outErrorDb("ActiveEvent condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("ActiveEvent condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue2) + sLog->outErrorDb("ActiveEvent condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("ActiveEvent condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ACHIEVEMENT: { - AchievementEntry const* achievement = GetAchievementStore()->LookupEntry(cond->mConditionValue1); + AchievementEntry const* achievement = GetAchievementStore()->LookupEntry(cond->ConditionValue1); if (!achievement) { - sLog->outErrorDb("Achivement condition has non existing achivement id (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("Achivement condition has non existing achivement id (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2) - sLog->outErrorDb("Achivement condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("Achivement condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue2) + sLog->outErrorDb("Achivement condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("Achivement condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_CLASS: { - if (!(cond->mConditionValue1 & CLASSMASK_ALL_PLAYABLE)) + if (!(cond->ConditionValue1 & CLASSMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Class condition has non existing classmask (%u), skipped", cond->mConditionValue1 & ~CLASSMASK_ALL_PLAYABLE); + sLog->outErrorDb("Class condition has non existing classmask (%u), skipped", cond->ConditionValue1 & ~CLASSMASK_ALL_PLAYABLE); return false; } - if (cond->mConditionValue2) - sLog->outErrorDb("Class condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("Class condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue2) + sLog->outErrorDb("Class condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("Class condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_RACE: { - if (!(cond->mConditionValue1 & RACEMASK_ALL_PLAYABLE)) + if (!(cond->ConditionValue1 & RACEMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Race condition has non existing racemask (%u), skipped", cond->mConditionValue1 & ~RACEMASK_ALL_PLAYABLE); + sLog->outErrorDb("Race condition has non existing racemask (%u), skipped", cond->ConditionValue1 & ~RACEMASK_ALL_PLAYABLE); return false; } - if (cond->mConditionValue2) - sLog->outErrorDb("Race condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("Race condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue2) + sLog->outErrorDb("Race condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("Race condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_SPELL_SCRIPT_TARGET: { - if (cond->mConditionValue1 >= MAX_SPELL_TARGET_TYPE) + if (cond->ConditionValue1 >= MAX_SPELL_TARGET_TYPE) { - sLog->outErrorDb("SpellTarget condition has non existing spell target type (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("SpellTarget condition has non existing spell target type (%u), skipped", cond->ConditionValue1); return false; } - switch (cond->mConditionValue1) + switch (cond->ConditionValue1) { case SPELL_TARGET_TYPE_GAMEOBJECT: { - if (cond->mConditionValue2 && !sObjectMgr->GetGameObjectTemplate(cond->mConditionValue2)) + if (cond->ConditionValue2 && !sObjectMgr->GetGameObjectTemplate(cond->ConditionValue2)) { - sLog->outErrorDb("SpellTarget condition has non existing gameobject (%u) as target, skipped", cond->mConditionValue2); + sLog->outErrorDb("SpellTarget condition has non existing gameobject (%u) as target, skipped", cond->ConditionValue2); return false; } break; @@ -1388,16 +1388,16 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) case SPELL_TARGET_TYPE_CREATURE: case SPELL_TARGET_TYPE_DEAD: { - if (cond->mConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->mConditionValue2)) + if (cond->ConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->ConditionValue2)) { - sLog->outErrorDb("SpellTarget condition has non existing creature template entry (%u) as target, skipped", cond->mConditionValue2); + sLog->outErrorDb("SpellTarget condition has non existing creature template entry (%u) as target, skipped", cond->ConditionValue2); return false; } - const CreatureTemplate* cInfo = sObjectMgr->GetCreatureTemplate(cond->mConditionValue2); - if (cond->mSourceEntry == 30427 && !cInfo->SkinLootId) + const CreatureTemplate* cInfo = sObjectMgr->GetCreatureTemplate(cond->ConditionValue2); + if (cond->SourceEntry == 30427 && !cInfo->SkinLootId) { - sLog->outErrorDb("SpellTarget condition has creature entry %u as a target of spellid 30427, but this creature has no skinlootid. Gas extraction will not work!, skipped", cond->mConditionValue2); + sLog->outErrorDb("SpellTarget condition has creature entry %u as a target of spellid 30427, but this creature has no skinlootid. Gas extraction will not work!, skipped", cond->ConditionValue2); return false; } break; @@ -1407,277 +1407,277 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } case CONDITION_CREATURE_TARGET: { - if (!cond->mConditionValue1 && !sObjectMgr->GetCreatureTemplate(cond->mConditionValue1)) + if (!cond->ConditionValue1 && !sObjectMgr->GetCreatureTemplate(cond->ConditionValue1)) { - sLog->outErrorDb("CreatureTarget condition has non existing creature template entry (%u) as target, skipped", cond->mConditionValue1); + sLog->outErrorDb("CreatureTarget condition has non existing creature template entry (%u) as target, skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2) - sLog->outErrorDb("CreatureTarget condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("CreatureTarget condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue2) + sLog->outErrorDb("CreatureTarget condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("CreatureTarget condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_TARGET_HEALTH_BELOW_PCT: { - if (cond->mConditionValue1 > 100) + if (cond->ConditionValue1 > 100) { - sLog->outErrorDb("TargetHealthBelowPct condition has invalid data in value1 (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("TargetHealthBelowPct condition has invalid data in value1 (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2) - sLog->outErrorDb("TargetHealthBelowPct condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("TargetHealthBelowPct condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue2) + sLog->outErrorDb("TargetHealthBelowPct condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("TargetHealthBelowPct condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_TARGET_RANGE: { - if (cond->mConditionValue2 && cond->mConditionValue2 < cond->mConditionValue1)//maxDist can be 0 for infinit max range + if (cond->ConditionValue2 && cond->ConditionValue2 < cond->ConditionValue1)//maxDist can be 0 for infinit max range { sLog->outErrorDb("TargetRange condition has max distance closer then min distance, skipped"); return false; } - if (cond->mConditionValue3) - sLog->outErrorDb("TargetRange condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue3) + sLog->outErrorDb("TargetRange condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_MAPID: { - MapEntry const* me = sMapStore.LookupEntry(cond->mConditionValue1); + MapEntry const* me = sMapStore.LookupEntry(cond->ConditionValue1); if (!me) { - sLog->outErrorDb("Map condition has non existing map (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("Map condition has non existing map (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2) - sLog->outErrorDb("Map condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("Map condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue2) + sLog->outErrorDb("Map condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("Map condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ITEM_TARGET: { - if (!cond->mConditionValue1 || cond->mConditionValue1 > MAX_ITEM_REQ_TARGET_TYPE) + if (!cond->ConditionValue1 || cond->ConditionValue1 > MAX_ITEM_REQ_TARGET_TYPE) { - sLog->outErrorDb("ItemTarget condition has incorrect target type (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("ItemTarget condition has incorrect target type (%u), skipped", cond->ConditionValue1); return false; } - if (!cond->mConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->mConditionValue2)) + if (!cond->ConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->ConditionValue2)) { - sLog->outErrorDb("ItemTarget condition has non existing creature template entry (%u) as target, skipped", cond->mConditionValue2); + sLog->outErrorDb("ItemTarget condition has non existing creature template entry (%u) as target, skipped", cond->ConditionValue2); return false; } - if (cond->mConditionValue3) - sLog->outErrorDb("ItemTarget condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue3) + sLog->outErrorDb("ItemTarget condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_SPELL: { - if (!sSpellMgr->GetSpellInfo(cond->mConditionValue1)) + if (!sSpellMgr->GetSpellInfo(cond->ConditionValue1)) { - sLog->outErrorDb("Spell condition has non existing spell (Id: %d), skipped", cond->mConditionValue1); + sLog->outErrorDb("Spell condition has non existing spell (Id: %d), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2) - sLog->outErrorDb("Spell condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("Spell condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue2) + sLog->outErrorDb("Spell condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("Spell condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_LEVEL: { - if (cond->mConditionValue2 >= COMP_TYPE_MAX) + if (cond->ConditionValue2 >= COMP_TYPE_MAX) { - sLog->outErrorDb("Level condition has invalid option (%u), skipped", cond->mConditionValue2); + sLog->outErrorDb("Level condition has invalid option (%u), skipped", cond->ConditionValue2); return false; } - if (cond->mConditionValue3) - sLog->outErrorDb("Level condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue3) + sLog->outErrorDb("Level condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_DRUNKENSTATE: { - if (cond->mConditionValue1 > DRUNKEN_SMASHED) + if (cond->ConditionValue1 > DRUNKEN_SMASHED) { - sLog->outErrorDb("DrunkState condition has invalid state (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("DrunkState condition has invalid state (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2) + if (cond->ConditionValue2) { - sLog->outErrorDb("DrunkState condition has useless data in value2 (%u)!", cond->mConditionValue2); + sLog->outErrorDb("DrunkState condition has useless data in value2 (%u)!", cond->ConditionValue2); return false; } - if (cond->mConditionValue3) - sLog->outErrorDb("DrunkState condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue3) + sLog->outErrorDb("DrunkState condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_NEAR_CREATURE: { - if (!sObjectMgr->GetCreatureTemplate(cond->mConditionValue1)) + if (!sObjectMgr->GetCreatureTemplate(cond->ConditionValue1)) { - sLog->outErrorDb("NearCreature condition has non existing creature template entry (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("NearCreature condition has non existing creature template entry (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue3) - sLog->outErrorDb("NearCreature condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue3) + sLog->outErrorDb("NearCreature condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_NEAR_GAMEOBJECT: { - if (!sObjectMgr->GetGameObjectTemplate(cond->mConditionValue1)) + if (!sObjectMgr->GetGameObjectTemplate(cond->ConditionValue1)) { - sLog->outErrorDb("NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue3) - sLog->outErrorDb("NearGameObject condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue3) + sLog->outErrorDb("NearGameObject condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_OBJECT_ENTRY: { - switch (cond->mConditionValue1) + switch (cond->ConditionValue1) { case TYPEID_UNIT: - if (cond->mConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->mConditionValue2)) + if (cond->ConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->ConditionValue2)) { - sLog->outErrorDb("ObjectEntry condition has non existing creature template entry (%u), skipped", cond->mConditionValue2); + sLog->outErrorDb("ObjectEntry condition has non existing creature template entry (%u), skipped", cond->ConditionValue2); return false; } break; case TYPEID_GAMEOBJECT: - if (cond->mConditionValue2 && !sObjectMgr->GetGameObjectTemplate(cond->mConditionValue2)) + if (cond->ConditionValue2 && !sObjectMgr->GetGameObjectTemplate(cond->ConditionValue2)) { - sLog->outErrorDb("ObjectEntry condition has non existing game object template entry (%u), skipped", cond->mConditionValue2); + sLog->outErrorDb("ObjectEntry condition has non existing game object template entry (%u), skipped", cond->ConditionValue2); return false; } break; case TYPEID_PLAYER: case TYPEID_CORPSE: - if (cond->mConditionValue2) - sLog->outErrorDb("ObjectEntry condition has useless data in value2 (%u)!", cond->mConditionValue2); + if (cond->ConditionValue2) + sLog->outErrorDb("ObjectEntry condition has useless data in value2 (%u)!", cond->ConditionValue2); break; default: - sLog->outErrorDb("ObjectEntry condition has wrong typeid set (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("ObjectEntry condition has wrong typeid set (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue3) - sLog->outErrorDb("ObjectEntry condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue3) + sLog->outErrorDb("ObjectEntry condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_TYPE_MASK: { - if (!cond->mConditionValue1 || (cond->mConditionValue1 & ~(TYPEMASK_UNIT | TYPEMASK_PLAYER | TYPEMASK_GAMEOBJECT | TYPEMASK_CORPSE))) + if (!cond->ConditionValue1 || (cond->ConditionValue1 & ~(TYPEMASK_UNIT | TYPEMASK_PLAYER | TYPEMASK_GAMEOBJECT | TYPEMASK_CORPSE))) { - sLog->outErrorDb("TypeMask condition has invalid typemask set (%u), skipped", cond->mConditionValue2); + sLog->outErrorDb("TypeMask condition has invalid typemask set (%u), skipped", cond->ConditionValue2); return false; } - if (cond->mConditionValue2) - sLog->outErrorDb("TypeMask condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("TypeMask condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue2) + sLog->outErrorDb("TypeMask condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("TypeMask condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_RELATION_TO: { - if (cond->mConditionValue1 >= cond->GetMaxAvailableConditionTargets()) + if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets()) { - sLog->outErrorDb("RelationTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("RelationTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue1 == cond->mConditionTarget) + if (cond->ConditionValue1 == cond->ConditionTarget) { - sLog->outErrorDb("RelationTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("RelationTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2 >= RELATION_MAX) + if (cond->ConditionValue2 >= RELATION_MAX) { - sLog->outErrorDb("RelationTo condition has invalid ConditionValue2(RelationType) (%u), skipped", cond->mConditionValue2); + sLog->outErrorDb("RelationTo condition has invalid ConditionValue2(RelationType) (%u), skipped", cond->ConditionValue2); return false; } - if (cond->mConditionValue3) - sLog->outErrorDb("RelationTo condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue3) + sLog->outErrorDb("RelationTo condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_REACTION_TO: { - if (cond->mConditionValue1 >= cond->GetMaxAvailableConditionTargets()) + if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets()) { - sLog->outErrorDb("ReactionTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("ReactionTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue1 == cond->mConditionTarget) + if (cond->ConditionValue1 == cond->ConditionTarget) { - sLog->outErrorDb("ReactionTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("ReactionTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); return false; } - if (!cond->mConditionValue2) + if (!cond->ConditionValue2) { - sLog->outErrorDb("mConditionValue2 condition has invalid ConditionValue2(rankMask) (%u), skipped", cond->mConditionValue2); + sLog->outErrorDb("mConditionValue2 condition has invalid ConditionValue2(rankMask) (%u), skipped", cond->ConditionValue2); return false; } break; } case CONDITION_DISTANCE_TO: { - if (cond->mConditionValue1 >= cond->GetMaxAvailableConditionTargets()) + if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets()) { - sLog->outErrorDb("DistanceTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("DistanceTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue1 == cond->mConditionTarget) + if (cond->ConditionValue1 == cond->ConditionTarget) { - sLog->outErrorDb("DistanceTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("DistanceTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue3 >= COMP_TYPE_MAX) + if (cond->ConditionValue3 >= COMP_TYPE_MAX) { - sLog->outErrorDb("DistanceTo condition has invalid ComparisionType (%u), skipped", cond->mConditionValue3); + sLog->outErrorDb("DistanceTo condition has invalid ComparisionType (%u), skipped", cond->ConditionValue3); return false; } break; } case CONDITION_ALIVE: { - if (cond->mConditionValue1) - sLog->outErrorDb("Alive condition has useless data in value1 (%u)!", cond->mConditionValue1); - if (cond->mConditionValue2) - sLog->outErrorDb("Alive condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("Alive condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue1) + sLog->outErrorDb("Alive condition has useless data in value1 (%u)!", cond->ConditionValue1); + if (cond->ConditionValue2) + sLog->outErrorDb("Alive condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("Alive condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_HP_VAL: { - if (cond->mConditionValue2 >= COMP_TYPE_MAX) + if (cond->ConditionValue2 >= COMP_TYPE_MAX) { - sLog->outErrorDb("HpVal condition has invalid ComparisionType (%u), skipped", cond->mConditionValue2); + sLog->outErrorDb("HpVal condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); return false; } - if (cond->mConditionValue3) - sLog->outErrorDb("HpVal condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue3) + sLog->outErrorDb("HpVal condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_HP_PCT: { - if (cond->mConditionValue1 > 100) + if (cond->ConditionValue1 > 100) { - sLog->outErrorDb("HpPct condition has too big percent value (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("HpPct condition has too big percent value (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue2 >= COMP_TYPE_MAX) + if (cond->ConditionValue2 >= COMP_TYPE_MAX) { - sLog->outErrorDb("HpPct condition has invalid ComparisionType (%u), skipped", cond->mConditionValue2); + sLog->outErrorDb("HpPct condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); return false; } - if (cond->mConditionValue3) - sLog->outErrorDb("HpPct condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue3) + sLog->outErrorDb("HpPct condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_AREAID: @@ -1685,21 +1685,21 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) break; case CONDITION_WORLD_STATE: { - if (!sWorld->getWorldState(cond->mConditionValue1)) + if (!sWorld->getWorldState(cond->ConditionValue1)) { - sLog->outErrorDb("World state condition has non existing world state in value1 (%u), skipped", cond->mConditionValue1); + sLog->outErrorDb("World state condition has non existing world state in value1 (%u), skipped", cond->ConditionValue1); return false; } - if (cond->mConditionValue3) - sLog->outErrorDb("World state condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue3) + sLog->outErrorDb("World state condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_PHASEMASK: { - if (cond->mConditionValue2) - sLog->outErrorDb("Phasemask condition has useless data in value2 (%u)!", cond->mConditionValue2); - if (cond->mConditionValue3) - sLog->outErrorDb("Phasemask condition has useless data in value3 (%u)!", cond->mConditionValue3); + if (cond->ConditionValue2) + sLog->outErrorDb("Phasemask condition has useless data in value2 (%u)!", cond->ConditionValue2); + if (cond->ConditionValue3) + sLog->outErrorDb("Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } default: diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index f3e9c728ac1..dc204ccd0ec 100755 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -28,7 +28,7 @@ class WorldObject; class LootTemplate; struct Condition; -enum ConditionType +enum ConditionTypes { // value1 value2 value3 CONDITION_NONE = 0, // 0 0 0 always true CONDITION_AURA = 1, // spell_id effindex use target? true if player (or target, if value3) has aura of spell_id with effect effindex @@ -140,40 +140,40 @@ struct ConditionSourceInfo struct Condition { - ConditionSourceType mSourceType; //SourceTypeOrReferenceId - uint32 mSourceGroup; - int32 mSourceEntry; - uint32 mSourceId; // So far, only used in CONDITION_SOURCE_TYPE_SMART_EVENT - uint32 mElseGroup; - ConditionType mConditionType; //ConditionTypeOrReference - uint8 mConditionTarget; - uint32 mConditionValue1; - uint32 mConditionValue2; - uint32 mConditionValue3; - uint32 ErrorTextd; - uint32 mReferenceId; - uint32 mScriptId; - bool mNegativeCondition; + ConditionSourceType SourceType; //SourceTypeOrReferenceId + uint32 SourceGroup; + int32 SourceEntry; + uint32 SourceId; // So far, only used in CONDITION_SOURCE_TYPE_SMART_EVENT + uint32 ElseGroup; + ConditionTypes ConditionType; //ConditionTypeOrReference + uint32 ConditionValue1; + uint32 ConditionValue2; + uint32 ConditionValue3; + uint32 ErrorTextId; + uint32 ReferenceId; + uint32 ScriptId; + uint8 ConditionTarget; + bool NegativeCondition; Condition() { - mSourceType = CONDITION_SOURCE_TYPE_NONE; - mSourceGroup = 0; - mSourceEntry = 0; - mElseGroup = 0; - mConditionType = CONDITION_NONE; - mConditionTarget = 0; - mConditionValue1 = 0; - mConditionValue2 = 0; - mConditionValue3 = 0; - mReferenceId = 0; - ErrorTextd = 0; - mScriptId = 0; - mNegativeCondition = false; + SourceType = CONDITION_SOURCE_TYPE_NONE; + SourceGroup = 0; + SourceEntry = 0; + ElseGroup = 0; + ConditionType = CONDITION_NONE; + ConditionTarget = 0; + ConditionValue1 = 0; + ConditionValue2 = 0; + ConditionValue3 = 0; + ReferenceId = 0; + ErrorTextId = 0; + ScriptId = 0; + NegativeCondition = false; } bool Meets(ConditionSourceInfo& sourceInfo); - bool isLoaded() const { return mConditionType > CONDITION_NONE || mReferenceId; } + bool isLoaded() const { return ConditionType > CONDITION_NONE || ReferenceId; } uint32 GetMaxAvailableConditionTargets(); }; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index f6689862dbf..64b0e542467 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1570,7 +1570,7 @@ void Player::Update(uint32 p_time) while (iter != m_timedquests.end()) { QuestStatusData& q_status = m_QuestStatus[*iter]; - if (q_status.m_timer <= p_time) + if (q_status.Timer <= p_time) { uint32 quest_id = *iter; ++iter; // current iter will be removed in FailQuest @@ -1578,7 +1578,7 @@ void Player::Update(uint32 p_time) } else { - q_status.m_timer -= p_time; + q_status.Timer -= p_time; m_QuestStatusSave[*iter] = true; ++iter; } @@ -6955,38 +6955,38 @@ void Player::RewardReputation(Unit* pVictim, float rate) float favored_rep_mult = 0; if ((HasAura(32096) || HasAura(32098)) && (zone == 3483 || zone == 3562 || zone == 3836 || zone == 3713 || zone == 3714)) favored_rep_mult = 0.25; // Thrallmar's Favor and Honor Hold's Favor - else if (HasAura(30754) && (Rep->repfaction1 == 609 || Rep->repfaction2 == 609) && !ChampioningFaction) favored_rep_mult = 0.25; // Cenarion Favor + else if (HasAura(30754) && (Rep->RepFaction1 == 609 || Rep->RepFaction2 == 609) && !ChampioningFaction) favored_rep_mult = 0.25; // Cenarion Favor if (favored_rep_mult > 0) favored_rep_mult *= 2; // Multiplied by 2 because the reputation is divided by 2 for some reason (See "donerep1 / 2" and "donerep2 / 2") -- if you know why this is done, please update/explain :) // Favored reputation increase END bool recruitAFriend = GetsRecruitAFriendBonus(false); - if (Rep->repfaction1 && (!Rep->team_dependent || team == ALLIANCE)) + if (Rep->RepFaction1 && (!Rep->TeamDependent || team == ALLIANCE)) { - int32 donerep1 = CalculateReputationGain(pVictim->getLevel(), Rep->repvalue1, ChampioningFaction ? ChampioningFaction : Rep->repfaction1, false); + int32 donerep1 = CalculateReputationGain(pVictim->getLevel(), Rep->RepValue1, ChampioningFaction ? ChampioningFaction : Rep->RepFaction1, false); donerep1 = int32(donerep1*(rate + favored_rep_mult)); if (recruitAFriend) donerep1 = int32(donerep1 * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS))); - FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->repfaction1); + FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction1); uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1); - if (factionEntry1 && current_reputation_rank1 <= Rep->reputation_max_cap1) + if (factionEntry1 && current_reputation_rank1 <= Rep->ReputationMaxCap1) GetReputationMgr().ModifyReputation(factionEntry1, donerep1); } - if (Rep->repfaction2 && (!Rep->team_dependent || team == HORDE)) + if (Rep->RepFaction2 && (!Rep->TeamDependent || team == HORDE)) { - int32 donerep2 = CalculateReputationGain(pVictim->getLevel(), Rep->repvalue2, ChampioningFaction ? ChampioningFaction : Rep->repfaction2, false); + int32 donerep2 = CalculateReputationGain(pVictim->getLevel(), Rep->RepValue2, ChampioningFaction ? ChampioningFaction : Rep->RepFaction2, false); donerep2 = int32(donerep2*(rate + favored_rep_mult)); if (recruitAFriend) donerep2 = int32(donerep2 * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS))); - FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->repfaction2); + FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->RepFaction2); uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2); - if (factionEntry2 && current_reputation_rank2 <= Rep->reputation_max_cap2) + if (factionEntry2 && current_reputation_rank2 <= Rep->ReputationMaxCap2) GetReputationMgr().ModifyReputation(factionEntry2, donerep2); } } @@ -14678,13 +14678,13 @@ bool Player::CanCompleteQuest(uint32 quest_id) QuestStatusData &q_status = itr->second; - if (q_status.m_status == QUEST_STATUS_INCOMPLETE) + if (q_status.Status == QUEST_STATUS_INCOMPLETE) { if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_DELIVER)) { for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; i++) { - if (qInfo->RequiredItemCount[i]!= 0 && q_status.m_itemcount[i] < qInfo->RequiredItemCount[i]) + if (qInfo->RequiredItemCount[i]!= 0 && q_status.ItemCount[i] < qInfo->RequiredItemCount[i]) return false; } } @@ -14696,19 +14696,19 @@ bool Player::CanCompleteQuest(uint32 quest_id) if (qInfo->RequiredNpcOrGo[i] == 0) continue; - if (qInfo->RequiredNpcOrGoCount[i] != 0 && q_status.m_creatureOrGOcount[i] < qInfo->RequiredNpcOrGoCount[i]) + if (qInfo->RequiredNpcOrGoCount[i] != 0 && q_status.CreatureOrGOCount[i] < qInfo->RequiredNpcOrGoCount[i]) return false; } } if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_PLAYER_KILL)) - if (qInfo->GetPlayersSlain() != 0 && q_status.m_playercount < qInfo->GetPlayersSlain()) + if (qInfo->GetPlayersSlain() != 0 && q_status.PlayerCount < qInfo->GetPlayersSlain()) return false; - if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT) && !q_status.m_explored) + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT) && !q_status.Explored) return false; - if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_TIMED) && q_status.m_timer == 0) + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_TIMED) && q_status.Timer == 0) return false; if (qInfo->GetRewOrReqMoney() < 0) @@ -14835,23 +14835,23 @@ void Player::AddQuest(Quest const* quest, Object* questGiver) QuestStatusData& questStatusData = m_QuestStatus[quest_id]; // check for repeatable quests status reset - questStatusData.m_status = QUEST_STATUS_INCOMPLETE; - questStatusData.m_explored = false; + questStatusData.Status = QUEST_STATUS_INCOMPLETE; + questStatusData.Explored = false; if (quest->HasFlag(QUEST_TRINITY_FLAGS_DELIVER)) { for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) - questStatusData.m_itemcount[i] = 0; + questStatusData.ItemCount[i] = 0; } if (quest->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO)) { for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) - questStatusData.m_creatureOrGOcount[i] = 0; + questStatusData.CreatureOrGOCount[i] = 0; } if (quest->HasFlag(QUEST_TRINITY_FLAGS_PLAYER_KILL)) - questStatusData.m_playercount = 0; + questStatusData.PlayerCount = 0; GiveQuestSourceItem(quest); AdjustQuestReqItemCount(quest, questStatusData); @@ -14871,14 +14871,14 @@ void Player::AddQuest(Quest const* quest, Object* questGiver) // shared timed quest if (questGiver && questGiver->GetTypeId() == TYPEID_PLAYER) - limittime = questGiver->ToPlayer()->getQuestStatusMap()[quest_id].m_timer / IN_MILLISECONDS; + limittime = questGiver->ToPlayer()->getQuestStatusMap()[quest_id].Timer / IN_MILLISECONDS; AddTimedQuest(quest_id); - questStatusData.m_timer = limittime * IN_MILLISECONDS; + questStatusData.Timer = limittime * IN_MILLISECONDS; qtime = static_cast(time(NULL)) + limittime; } else - questStatusData.m_timer = 0; + questStatusData.Timer = 0; SetQuestSlot(log_slot, quest_id, qtime); @@ -15141,7 +15141,7 @@ void Player::FailQuest(uint32 questId) QuestStatusData& q_status = m_QuestStatus[questId]; RemoveTimedQuest(questId); - q_status.m_timer = 0; + q_status.Timer = 0; SendQuestTimerFailed(questId); } @@ -15471,7 +15471,7 @@ bool Player::SatisfyQuestPrevChain(Quest const* qInfo, bool msg) QuestStatusMap::const_iterator itr = m_QuestStatus.find(*iter); // If any of the previous quests in chain active, return false - if (itr != m_QuestStatus.end() && itr->second.m_status != QUEST_STATUS_NONE) + if (itr != m_QuestStatus.end() && itr->second.Status != QUEST_STATUS_NONE) { if (msg) SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); @@ -15631,7 +15631,7 @@ QuestStatus Player::GetQuestStatus(uint32 quest_id) const { QuestStatusMap::const_iterator itr = m_QuestStatus.find(quest_id); if (itr != m_QuestStatus.end()) - return itr->second.m_status; + return itr->second.Status; if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest_id)) if (!qInfo->IsRepeatable() && m_RewardedQuests.find(quest_id) != m_RewardedQuests.end()) @@ -15647,7 +15647,7 @@ bool Player::CanShareQuest(uint32 quest_id) const { QuestStatusMap::const_iterator itr = m_QuestStatus.find(quest_id); if (itr != m_QuestStatus.end()) - return itr->second.m_status == QUEST_STATUS_INCOMPLETE; + return itr->second.Status == QUEST_STATUS_INCOMPLETE; } return false; } @@ -15656,7 +15656,7 @@ void Player::SetQuestStatus(uint32 quest_id, QuestStatus status) { if (sObjectMgr->GetQuestTemplate(quest_id)) { - m_QuestStatus[quest_id].m_status = status; + m_QuestStatus[quest_id].Status = status; m_QuestStatusSave[quest_id] = true; } @@ -15693,7 +15693,7 @@ uint16 Player::GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) if (qInfo->RequiredNpcOrGo[j] == entry) - return m_QuestStatus[quest_id].m_creatureOrGOcount[j]; + return m_QuestStatus[quest_id].CreatureOrGOCount[j]; return 0; } @@ -15709,7 +15709,7 @@ void Player::AdjustQuestReqItemCount(Quest const* quest, QuestStatusData& questS { uint32 curitemcount = GetItemCount(quest->RequiredItemId[i], true); - questStatusData.m_itemcount[i] = std::min(curitemcount, reqitemcount); + questStatusData.ItemCount[i] = std::min(curitemcount, reqitemcount); m_QuestStatusSave[quest->GetQuestId()] = true; } } @@ -15734,9 +15734,9 @@ void Player::AreaExploredOrEventHappens(uint32 questId) { QuestStatusData& q_status = m_QuestStatus[questId]; - if (!q_status.m_explored) + if (!q_status.Explored) { - q_status.m_explored = true; + q_status.Explored = true; m_QuestStatusSave[questId] = true; } } @@ -15773,7 +15773,7 @@ void Player::ItemAddedQuestCheck(uint32 entry, uint32 count) QuestStatusData& q_status = m_QuestStatus[questid]; - if (q_status.m_status != QUEST_STATUS_INCOMPLETE) + if (q_status.Status != QUEST_STATUS_INCOMPLETE) continue; Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid); @@ -15786,11 +15786,11 @@ void Player::ItemAddedQuestCheck(uint32 entry, uint32 count) if (reqitem == entry) { uint32 reqitemcount = qInfo->RequiredItemCount[j]; - uint16 curitemcount = q_status.m_itemcount[j]; + uint16 curitemcount = q_status.ItemCount[j]; if (curitemcount < reqitemcount) { uint16 additemcount = curitemcount + count <= reqitemcount ? count : reqitemcount - curitemcount; - q_status.m_itemcount[j] += additemcount; + q_status.ItemCount[j] += additemcount; m_QuestStatusSave[questid] = true; @@ -15827,14 +15827,14 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count) uint32 reqitemcount = qInfo->RequiredItemCount[j]; uint16 curitemcount; - if (q_status.m_status != QUEST_STATUS_COMPLETE) - curitemcount = q_status.m_itemcount[j]; + if (q_status.Status != QUEST_STATUS_COMPLETE) + curitemcount = q_status.ItemCount[j]; else curitemcount = GetItemCount(entry, true); if (curitemcount < reqitemcount + count) { uint16 remitemcount = curitemcount <= reqitemcount ? count : count + reqitemcount - curitemcount; - q_status.m_itemcount[j] = (curitemcount <= remitemcount) ? 0 : curitemcount - remitemcount; + q_status.ItemCount[j] = (curitemcount <= remitemcount) ? 0 : curitemcount - remitemcount; m_QuestStatusSave[questid] = true; @@ -15882,7 +15882,7 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid) continue; // just if !ingroup || !noraidgroup || raidgroup QuestStatusData& q_status = m_QuestStatus[questid]; - if (q_status.m_status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid())) + if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid())) { if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST)) { @@ -15901,10 +15901,10 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid) if (reqkill == real_entry) { uint32 reqkillcount = qInfo->RequiredNpcOrGoCount[j]; - uint16 curkillcount = q_status.m_creatureOrGOcount[j]; + uint16 curkillcount = q_status.CreatureOrGOCount[j]; if (curkillcount < reqkillcount) { - q_status.m_creatureOrGOcount[j] = curkillcount + addkillcount; + q_status.CreatureOrGOCount[j] = curkillcount + addkillcount; m_QuestStatusSave[questid] = true; @@ -15937,16 +15937,16 @@ void Player::KilledPlayerCredit() continue; // just if !ingroup || !noraidgroup || raidgroup QuestStatusData& q_status = m_QuestStatus[questid]; - if (q_status.m_status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid())) + if (q_status.Status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid())) { if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_PLAYER_KILL)) { uint32 reqkill = qInfo->GetPlayersSlain(); - uint16 curkill = q_status.m_playercount; + uint16 curkill = q_status.PlayerCount; if (curkill < reqkill) { - q_status.m_playercount = curkill + addkillcount; + q_status.PlayerCount = curkill + addkillcount; m_QuestStatusSave[questid] = true; @@ -15979,7 +15979,7 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id) QuestStatusData& q_status = m_QuestStatus[questid]; - if (q_status.m_status == QUEST_STATUS_INCOMPLETE) + if (q_status.Status == QUEST_STATUS_INCOMPLETE) { if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST)) { @@ -16020,10 +16020,10 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id) continue; uint32 reqCastCount = qInfo->RequiredNpcOrGoCount[j]; - uint16 curCastCount = q_status.m_creatureOrGOcount[j]; + uint16 curCastCount = q_status.CreatureOrGOCount[j]; if (curCastCount < reqCastCount) { - q_status.m_creatureOrGOcount[j] = curCastCount + addCastCount; + q_status.CreatureOrGOCount[j] = curCastCount + addCastCount; m_QuestStatusSave[questid] = true; @@ -16056,7 +16056,7 @@ void Player::TalkedToCreature(uint32 entry, uint64 guid) QuestStatusData& q_status = m_QuestStatus[questid]; - if (q_status.m_status == QUEST_STATUS_INCOMPLETE) + if (q_status.Status == QUEST_STATUS_INCOMPLETE) { if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO)) { @@ -16077,10 +16077,10 @@ void Player::TalkedToCreature(uint32 entry, uint64 guid) if (reqTarget == entry) { uint32 reqTalkCount = qInfo->RequiredNpcOrGoCount[j]; - uint16 curTalkCount = q_status.m_creatureOrGOcount[j]; + uint16 curTalkCount = q_status.CreatureOrGOCount[j]; if (curTalkCount < reqTalkCount) { - q_status.m_creatureOrGOcount[j] = curTalkCount + addTalkCount; + q_status.CreatureOrGOCount[j] = curTalkCount + addTalkCount; m_QuestStatusSave[questid] = true; @@ -16111,7 +16111,7 @@ void Player::MoneyChanged(uint32 count) { QuestStatusData& q_status = m_QuestStatus[questid]; - if (q_status.m_status == QUEST_STATUS_INCOMPLETE) + if (q_status.Status == QUEST_STATUS_INCOMPLETE) { if (int32(count) >= -qInfo->GetRewOrReqMoney()) { @@ -16119,7 +16119,7 @@ void Player::MoneyChanged(uint32 count) CompleteQuest(questid); } } - else if (q_status.m_status == QUEST_STATUS_COMPLETE) + else if (q_status.Status == QUEST_STATUS_COMPLETE) { if (int32(count) < -qInfo->GetRewOrReqMoney()) IncompleteQuest(questid); @@ -16139,13 +16139,13 @@ void Player::ReputationChanged(FactionEntry const* factionEntry) if (qInfo->GetRepObjectiveFaction() == factionEntry->ID) { QuestStatusData& q_status = m_QuestStatus[questid]; - if (q_status.m_status == QUEST_STATUS_INCOMPLETE) + if (q_status.Status == QUEST_STATUS_INCOMPLETE) { if (GetReputationMgr().GetReputation(factionEntry) >= qInfo->GetRepObjectiveValue()) if (CanCompleteQuest(questid)) CompleteQuest(questid); } - else if (q_status.m_status == QUEST_STATUS_COMPLETE) + else if (q_status.Status == QUEST_STATUS_COMPLETE) { if (GetReputationMgr().GetReputation(factionEntry) < qInfo->GetRepObjectiveValue()) IncompleteQuest(questid); @@ -16167,13 +16167,13 @@ void Player::ReputationChanged2(FactionEntry const* factionEntry) if (qInfo->GetRepObjectiveFaction2() == factionEntry->ID) { QuestStatusData& q_status = m_QuestStatus[questid]; - if (q_status.m_status == QUEST_STATUS_INCOMPLETE) + if (q_status.Status == QUEST_STATUS_INCOMPLETE) { if (GetReputationMgr().GetReputation(factionEntry) >= qInfo->GetRepObjectiveValue2()) if (CanCompleteQuest(questid)) CompleteQuest(questid); } - else if (q_status.m_status == QUEST_STATUS_COMPLETE) + else if (q_status.Status == QUEST_STATUS_COMPLETE) { if (GetReputationMgr().GetReputation(factionEntry) < qInfo->GetRepObjectiveValue2()) IncompleteQuest(questid); @@ -16198,7 +16198,7 @@ bool Player::HasQuestForItem(uint32 itemid) const QuestStatusData const& q_status = qs_itr->second; - if (q_status.m_status == QUEST_STATUS_INCOMPLETE) + if (q_status.Status == QUEST_STATUS_INCOMPLETE) { Quest const* qinfo = sObjectMgr->GetQuestTemplate(questid); if (!qinfo) @@ -16213,7 +16213,7 @@ bool Player::HasQuestForItem(uint32 itemid) const // This part for ReqItem drop for (uint8 j = 0; j < QUEST_ITEM_OBJECTIVES_COUNT; ++j) { - if (itemid == qinfo->RequiredItemId[j] && q_status.m_itemcount[j] < qinfo->RequiredItemCount[j]) + if (itemid == qinfo->RequiredItemId[j] && q_status.ItemCount[j] < qinfo->RequiredItemCount[j]) return true; } // This part - for ReqSource @@ -17776,14 +17776,14 @@ void Player::_LoadQuestStatus(PreparedQueryResult result) uint8 qstatus = fields[1].GetUInt8(); if (qstatus < MAX_QUEST_STATUS) - questStatusData.m_status = QuestStatus(qstatus); + questStatusData.Status = QuestStatus(qstatus); else { - questStatusData.m_status = QUEST_STATUS_INCOMPLETE; + questStatusData.Status = QUEST_STATUS_INCOMPLETE; sLog->outError("Player %s have invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).", GetName(), quest_id, qstatus); } - questStatusData.m_explored = (fields[2].GetUInt8() > 0); + questStatusData.Explored = (fields[2].GetUInt8() > 0); time_t quest_time = time_t(fields[3].GetUInt32()); @@ -17792,44 +17792,44 @@ void Player::_LoadQuestStatus(PreparedQueryResult result) AddTimedQuest(quest_id); if (quest_time <= sWorld->GetGameTime()) - questStatusData.m_timer = 1; + questStatusData.Timer = 1; else - questStatusData.m_timer = uint32((quest_time - sWorld->GetGameTime()) * IN_MILLISECONDS); + questStatusData.Timer = uint32((quest_time - sWorld->GetGameTime()) * IN_MILLISECONDS); } else quest_time = 0; - questStatusData.m_creatureOrGOcount[0] = fields[4].GetUInt16(); - questStatusData.m_creatureOrGOcount[1] = fields[5].GetUInt16(); - questStatusData.m_creatureOrGOcount[2] = fields[6].GetUInt16(); - questStatusData.m_creatureOrGOcount[3] = fields[7].GetUInt16(); - questStatusData.m_itemcount[0] = fields[8].GetUInt16(); - questStatusData.m_itemcount[1] = fields[9].GetUInt16(); - questStatusData.m_itemcount[2] = fields[10].GetUInt16(); - questStatusData.m_itemcount[3] = fields[11].GetUInt16(); - questStatusData.m_playercount = fields[12].GetUInt16(); + questStatusData.CreatureOrGOCount[0] = fields[4].GetUInt16(); + questStatusData.CreatureOrGOCount[1] = fields[5].GetUInt16(); + questStatusData.CreatureOrGOCount[2] = fields[6].GetUInt16(); + questStatusData.CreatureOrGOCount[3] = fields[7].GetUInt16(); + questStatusData.ItemCount[0] = fields[8].GetUInt16(); + questStatusData.ItemCount[1] = fields[9].GetUInt16(); + questStatusData.ItemCount[2] = fields[10].GetUInt16(); + questStatusData.ItemCount[3] = fields[11].GetUInt16(); + questStatusData.PlayerCount = fields[12].GetUInt16(); // add to quest log - if (slot < MAX_QUEST_LOG_SIZE && questStatusData.m_status != QUEST_STATUS_NONE) + if (slot < MAX_QUEST_LOG_SIZE && questStatusData.Status != QUEST_STATUS_NONE) { SetQuestSlot(slot, quest_id, uint32(quest_time)); // cast can't be helped - if (questStatusData.m_status == QUEST_STATUS_COMPLETE) + if (questStatusData.Status == QUEST_STATUS_COMPLETE) SetQuestSlotState(slot, QUEST_STATE_COMPLETE); - else if (questStatusData.m_status == QUEST_STATUS_FAILED) + else if (questStatusData.Status == QUEST_STATUS_FAILED) SetQuestSlotState(slot, QUEST_STATE_FAIL); for (uint8 idx = 0; idx < QUEST_OBJECTIVES_COUNT; ++idx) - if (questStatusData.m_creatureOrGOcount[idx]) - SetQuestSlotCounter(slot, idx, questStatusData.m_creatureOrGOcount[idx]); + if (questStatusData.CreatureOrGOCount[idx]) + SetQuestSlotCounter(slot, idx, questStatusData.CreatureOrGOCount[idx]); - if (questStatusData.m_playercount) - SetQuestSlotCounter(slot, QUEST_PVP_KILL_SLOT, questStatusData.m_playercount); + if (questStatusData.PlayerCount) + SetQuestSlotCounter(slot, QUEST_PVP_KILL_SLOT, questStatusData.PlayerCount); ++slot; } - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Quest status is {%u} for quest {%u} for player (GUID: %u)", questStatusData.m_status, quest_id, GetGUIDLow()); + sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Quest status is {%u} for quest {%u} for player (GUID: %u)", questStatusData.Status, quest_id, GetGUIDLow()); } } while (result->NextRow()); @@ -19004,10 +19004,10 @@ void Player::_SaveQuestStatus(SQLTransaction& trans) if (saveItr->second) { statusItr = m_QuestStatus.find(saveItr->first); - if (statusItr != m_QuestStatus.end() && (keepAbandoned || statusItr->second.m_status != QUEST_STATUS_NONE)) + if (statusItr != m_QuestStatus.end() && (keepAbandoned || statusItr->second.Status != QUEST_STATUS_NONE)) trans->PAppend("REPLACE INTO character_queststatus (guid, quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3, itemcount4, playercount) " "VALUES ('%u', '%u', '%u', '%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", - GetGUIDLow(), statusItr->first, statusItr->second.m_status, statusItr->second.m_explored, uint64(statusItr->second.m_timer / IN_MILLISECONDS+ sWorld->GetGameTime()), statusItr->second.m_creatureOrGOcount[0], statusItr->second.m_creatureOrGOcount[1], statusItr->second.m_creatureOrGOcount[2], statusItr->second.m_creatureOrGOcount[3], statusItr->second.m_itemcount[0], statusItr->second.m_itemcount[1], statusItr->second.m_itemcount[2], statusItr->second.m_itemcount[3], statusItr->second.m_playercount); + GetGUIDLow(), statusItr->first, statusItr->second.Status, statusItr->second.Explored, uint64(statusItr->second.Timer / IN_MILLISECONDS+ sWorld->GetGameTime()), statusItr->second.CreatureOrGOCount[0], statusItr->second.CreatureOrGOCount[1], statusItr->second.CreatureOrGOCount[2], statusItr->second.CreatureOrGOCount[3], statusItr->second.ItemCount[0], statusItr->second.ItemCount[1], statusItr->second.ItemCount[2], statusItr->second.ItemCount[3], statusItr->second.PlayerCount); } else trans->PAppend("DELETE FROM character_queststatus WHERE guid = %u AND quest = %u", GetGUIDLow(), saveItr->first); @@ -22337,7 +22337,7 @@ bool Player::HasQuestForGO(int32 GOId) const QuestStatusData const& qs = qs_itr->second; - if (qs.m_status == QUEST_STATUS_INCOMPLETE) + if (qs.Status == QUEST_STATUS_INCOMPLETE) { Quest const* qinfo = sObjectMgr->GetQuestTemplate(questid); if (!qinfo) @@ -22351,7 +22351,7 @@ bool Player::HasQuestForGO(int32 GOId) const if (qinfo->RequiredNpcOrGo[j] >= 0) //skip non GO case continue; - if ((-1)*GOId == qinfo->RequiredNpcOrGo[j] && qs.m_creatureOrGOcount[j] < qinfo->RequiredNpcOrGoCount[j]) + if ((-1)*GOId == qinfo->RequiredNpcOrGo[j] && qs.CreatureOrGOCount[j] < qinfo->RequiredNpcOrGoCount[j]) return true; } } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 345df411165..0fb2a6fb75d 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1062,19 +1062,16 @@ private: Player* _killer; Unit* _victim; - bool _isBattleGround; - - bool _isPvP; - Group* _group; float _groupRate; - uint8 _maxLevel; Player* _maxNotGrayMember; uint32 _count; uint32 _sumLevel; - bool _isFullXP; - uint32 _xp; + bool _isFullXP; + uint8 _maxLevel; + bool _isBattleGround; + bool _isPvP; }; class Player : public Unit, public GridObject diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h index c70ce0b9367..57d9204ad1c 100644 --- a/src/server/game/Entities/Vehicle/VehicleDefines.h +++ b/src/server/game/Entities/Vehicle/VehicleDefines.h @@ -65,10 +65,10 @@ struct VehicleAccessory VehicleAccessory(uint32 entry, int8 seatId, bool isMinion, uint8 summonType, uint32 summonTime) : AccessoryEntry(entry), SeatId(seatId), IsMinion(isMinion), SummonedType(summonType), SummonTime(summonTime) {} uint32 AccessoryEntry; - int8 SeatId; uint32 IsMinion; - uint8 SummonedType; uint32 SummonTime; + int8 SeatId; + uint8 SummonedType; }; typedef std::vector VehicleAccessoryList; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 52b33cf1e6f..2feb2eddf76 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -6827,15 +6827,15 @@ void ObjectMgr::LoadReputationOnKill() uint32 creature_id = fields[0].GetUInt32(); ReputationOnKillEntry repOnKill; - repOnKill.repfaction1 = fields[1].GetUInt32(); - repOnKill.repfaction2 = fields[2].GetUInt32(); - repOnKill.is_teamaward1 = fields[3].GetBool(); - repOnKill.reputation_max_cap1 = fields[4].GetUInt32(); - repOnKill.repvalue1 = fields[5].GetInt32(); - repOnKill.is_teamaward2 = fields[6].GetBool(); - repOnKill.reputation_max_cap2 = fields[7].GetUInt32(); - repOnKill.repvalue2 = fields[8].GetInt32(); - repOnKill.team_dependent = fields[9].GetUInt8(); + repOnKill.RepFaction1 = fields[1].GetUInt32(); + repOnKill.RepFaction2 = fields[2].GetUInt32(); + repOnKill.IsTeamAward1 = fields[3].GetBool(); + repOnKill.ReputationMaxCap1 = fields[4].GetUInt32(); + repOnKill.RepValue1 = fields[5].GetInt32(); + repOnKill.IsTeamAward2 = fields[6].GetBool(); + repOnKill.ReputationMaxCap2 = fields[7].GetUInt32(); + repOnKill.RepValue2 = fields[8].GetInt32(); + repOnKill.TeamDependent = fields[9].GetUInt8(); if (!GetCreatureTemplate(creature_id)) { @@ -6843,22 +6843,22 @@ void ObjectMgr::LoadReputationOnKill() continue; } - if (repOnKill.repfaction1) + if (repOnKill.RepFaction1) { - FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repOnKill.repfaction1); + FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repOnKill.RepFaction1); if (!factionEntry1) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.repfaction1); + sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction1); continue; } } - if (repOnKill.repfaction2) + if (repOnKill.RepFaction2) { - FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repOnKill.repfaction2); + FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repOnKill.RepFaction2); if (!factionEntry2) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.repfaction2); + sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction2); continue; } } diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index b69a234fcbf..fc342bfb534 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -440,15 +440,15 @@ struct RepRewardRate struct ReputationOnKillEntry { - uint32 repfaction1; - uint32 repfaction2; - bool is_teamaward1; - uint32 reputation_max_cap1; - int32 repvalue1; - bool is_teamaward2; - uint32 reputation_max_cap2; - int32 repvalue2; - bool team_dependent; + uint32 RepFaction1; + uint32 RepFaction2; + uint32 ReputationMaxCap1; + int32 RepValue1; + uint32 ReputationMaxCap2; + int32 RepValue2; + bool IsTeamAward1; + bool IsTeamAward2; + bool TeamDependent; }; struct RepSpilloverTemplate diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index d9e3d7ab823..564d0cce8b7 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -1364,7 +1364,7 @@ bool LootTemplate::addConditionItem(Condition* cond) { for (LootStoreItemList::iterator i = Entries.begin(); i != Entries.end(); ++i) { - if (i->itemid == cond->mSourceEntry) + if (i->itemid == cond->SourceEntry) { i->conditions.push_back(cond); return true; @@ -1380,7 +1380,7 @@ bool LootTemplate::addConditionItem(Condition* cond) { for (LootStoreItemList::iterator i = itemList->begin(); i != itemList->end(); ++i) { - if ((*i).itemid == cond->mSourceEntry) + if ((*i).itemid == cond->SourceEntry) { (*i).conditions.push_back(cond); return true; @@ -1392,7 +1392,7 @@ bool LootTemplate::addConditionItem(Condition* cond) { for (LootStoreItemList::iterator i = itemList->begin(); i != itemList->end(); ++i) { - if ((*i).itemid == cond->mSourceEntry) + if ((*i).itemid == cond->SourceEntry) { (*i).conditions.push_back(cond); return true; diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index b8c35d45e98..12011eab408 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -1022,24 +1022,24 @@ void Map::UnloadAll() // ***************************** GridMap::GridMap() { - m_flags = 0; + _flags = 0; // Area data - m_gridArea = 0; - m_area_map = NULL; + _gridArea = 0; + _areaMap = NULL; // Height level data - m_gridHeight = INVALID_HEIGHT; - m_gridGetHeight = &GridMap::getHeightFromFlat; + _gridHeight = INVALID_HEIGHT; + _gridGetHeight = &GridMap::getHeightFromFlat; m_V9 = NULL; m_V8 = NULL; // Liquid data - m_liquidType = 0; - m_liquid_offX = 0; - m_liquid_offY = 0; - m_liquid_width = 0; - m_liquid_height = 0; - m_liquidLevel = INVALID_HEIGHT; - m_liquid_type = NULL; - m_liquid_map = NULL; + _liquidType = 0; + _liquidOffX = 0; + _liquidOffY = 0; + _liquidWidth = 0; + _liquidHeight = 0; + _liquidLevel = INVALID_HEIGHT; + _liquidType = NULL; + _liquidMap = NULL; } GridMap::~GridMap() @@ -1097,17 +1097,17 @@ bool GridMap::loadData(char *filename) void GridMap::unloadData() { - delete[] m_area_map; + delete[] _areaMap; delete[] m_V9; delete[] m_V8; - delete[] m_liquid_type; - delete[] m_liquid_map; - m_area_map = NULL; + delete[] _liquidType; + delete[] _liquidMap; + _areaMap = NULL; m_V9 = NULL; m_V8 = NULL; - m_liquid_type = NULL; - m_liquid_map = NULL; - m_gridGetHeight = &GridMap::getHeightFromFlat; + _liquidType = NULL; + _liquidMap = NULL; + _gridGetHeight = &GridMap::getHeightFromFlat; } bool GridMap::loadAreaData(FILE* in, uint32 offset, uint32 /*size*/) @@ -1118,11 +1118,11 @@ bool GridMap::loadAreaData(FILE* in, uint32 offset, uint32 /*size*/) if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapAreaMagic.asUInt) return false; - m_gridArea = header.gridArea; + _gridArea = header.gridArea; if (!(header.flags & MAP_AREA_NO_AREA)) { - m_area_map = new uint16 [16*16]; - if (fread(m_area_map, sizeof(uint16), 16*16, in) != 16*16) + _areaMap = new uint16 [16*16]; + if (fread(_areaMap, sizeof(uint16), 16*16, in) != 16*16) return false; } return true; @@ -1136,7 +1136,7 @@ bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/) if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapHeightMagic.asUInt) return false; - m_gridHeight = header.gridHeight; + _gridHeight = header.gridHeight; if (!(header.flags & MAP_HEIGHT_NO_HEIGHT)) { if ((header.flags & MAP_HEIGHT_AS_INT16)) @@ -1146,8 +1146,8 @@ bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/) if (fread(m_uint16_V9, sizeof(uint16), 129*129, in) != 129*129 || fread(m_uint16_V8, sizeof(uint16), 128*128, in) != 128*128) return false; - m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 65535; - m_gridGetHeight = &GridMap::getHeightFromUint16; + _gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 65535; + _gridGetHeight = &GridMap::getHeightFromUint16; } else if ((header.flags & MAP_HEIGHT_AS_INT8)) { @@ -1156,8 +1156,8 @@ bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/) if (fread(m_uint8_V9, sizeof(uint8), 129*129, in) != 129*129 || fread(m_uint8_V8, sizeof(uint8), 128*128, in) != 128*128) return false; - m_gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 255; - m_gridGetHeight = &GridMap::getHeightFromUint8; + _gridIntHeightMultiplier = (header.gridMaxHeight - header.gridHeight) / 255; + _gridGetHeight = &GridMap::getHeightFromUint8; } else { @@ -1166,11 +1166,11 @@ bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/) if (fread(m_V9, sizeof(float), 129*129, in) != 129*129 || fread(m_V8, sizeof(float), 128*128, in) != 128*128) return false; - m_gridGetHeight = &GridMap::getHeightFromFloat; + _gridGetHeight = &GridMap::getHeightFromFloat; } } else - m_gridGetHeight = &GridMap::getHeightFromFlat; + _gridGetHeight = &GridMap::getHeightFromFlat; return true; } @@ -1182,23 +1182,23 @@ bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/) if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapLiquidMagic.asUInt) return false; - m_liquidType = header.liquidType; - m_liquid_offX = header.offsetX; - m_liquid_offY = header.offsetY; - m_liquid_width = header.width; - m_liquid_height= header.height; - m_liquidLevel = header.liquidLevel; + _liquidType = header.liquidType; + _liquidOffX = header.offsetX; + _liquidOffY = header.offsetY; + _liquidWidth = header.width; + _liquidHeight= header.height; + _liquidLevel = header.liquidLevel; if (!(header.flags & MAP_LIQUID_NO_TYPE)) { - m_liquid_type = new uint8 [16*16]; - if (fread(m_liquid_type, sizeof(uint8), 16*16, in) != 16*16) + _liquidType = new uint8 [16*16]; + if (fread(_liquidType, sizeof(uint8), 16*16, in) != 16*16) return false; } if (!(header.flags & MAP_LIQUID_NO_HEIGHT)) { - m_liquid_map = new float [m_liquid_width*m_liquid_height]; - if (fread(m_liquid_map, sizeof(float), m_liquid_width*m_liquid_height, in) != m_liquid_width*m_liquid_height) + _liquidMap = new float [_liquidWidth*_liquidHeight]; + if (fread(_liquidMap, sizeof(float), _liquidWidth*_liquidHeight, in) != _liquidWidth*_liquidHeight) return false; } return true; @@ -1206,25 +1206,25 @@ bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/) uint16 GridMap::getArea(float x, float y) { - if (!m_area_map) - return m_gridArea; + if (!_areaMap) + return _gridArea; x = 16 * (32 - x/SIZE_OF_GRIDS); y = 16 * (32 - y/SIZE_OF_GRIDS); int lx = (int)x & 15; int ly = (int)y & 15; - return m_area_map[lx*16 + ly]; + return _areaMap[lx*16 + ly]; } float GridMap::getHeightFromFlat(float /*x*/, float /*y*/) const { - return m_gridHeight; + return _gridHeight; } float GridMap::getHeightFromFloat(float x, float y) const { if (!m_V8 || !m_V9) - return m_gridHeight; + return _gridHeight; x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS); y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS); @@ -1306,7 +1306,7 @@ float GridMap::getHeightFromFloat(float x, float y) const float GridMap::getHeightFromUint8(float x, float y) const { if (!m_uint8_V8 || !m_uint8_V9) - return m_gridHeight; + return _gridHeight; x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS); y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS); @@ -1367,13 +1367,13 @@ float GridMap::getHeightFromUint8(float x, float y) const } } // Calculate height - return (float)((a * x) + (b * y) + c)*m_gridIntHeightMultiplier + m_gridHeight; + return (float)((a * x) + (b * y) + c)*_gridIntHeightMultiplier + _gridHeight; } float GridMap::getHeightFromUint16(float x, float y) const { if (!m_uint16_V8 || !m_uint16_V9) - return m_gridHeight; + return _gridHeight; x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS); y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS); @@ -1434,45 +1434,45 @@ float GridMap::getHeightFromUint16(float x, float y) const } } // Calculate height - return (float)((a * x) + (b * y) + c)*m_gridIntHeightMultiplier + m_gridHeight; + return (float)((a * x) + (b * y) + c)*_gridIntHeightMultiplier + _gridHeight; } float GridMap::getLiquidLevel(float x, float y) { - if (!m_liquid_map) - return m_liquidLevel; + if (!_liquidMap) + return _liquidLevel; x = MAP_RESOLUTION * (32 - x/SIZE_OF_GRIDS); y = MAP_RESOLUTION * (32 - y/SIZE_OF_GRIDS); - int cx_int = ((int)x & (MAP_RESOLUTION-1)) - m_liquid_offY; - int cy_int = ((int)y & (MAP_RESOLUTION-1)) - m_liquid_offX; + int cx_int = ((int)x & (MAP_RESOLUTION-1)) - _liquidOffY; + int cy_int = ((int)y & (MAP_RESOLUTION-1)) - _liquidOffX; - if (cx_int < 0 || cx_int >=m_liquid_height) + if (cx_int < 0 || cx_int >=_liquidHeight) return INVALID_HEIGHT; - if (cy_int < 0 || cy_int >=m_liquid_width) + if (cy_int < 0 || cy_int >=_liquidWidth) return INVALID_HEIGHT; - return m_liquid_map[cx_int*m_liquid_width + cy_int]; + return _liquidMap[cx_int*_liquidWidth + cy_int]; } uint8 GridMap::getTerrainType(float x, float y) { - if (!m_liquid_type) + if (!_liquidType) return 0; x = 16 * (32 - x/SIZE_OF_GRIDS); y = 16 * (32 - y/SIZE_OF_GRIDS); int lx = (int)x & 15; int ly = (int)y & 15; - return m_liquid_type[lx*16 + ly]; + return _liquidType[lx*16 + ly]; } // Get water state on map inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data) { // Check water type (if no water return) - if (!m_liquid_type && !m_liquidType) + if (!_liquidType && !_liquidType) return LIQUID_MAP_NO_WATER; // Get cell @@ -1483,7 +1483,7 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R int y_int = (int)cy & (MAP_RESOLUTION-1); // Check water type in cell - uint8 type = m_liquid_type ? m_liquid_type[(x_int>>3)*16 + (y_int>>3)] : m_liquidType; + uint8 type = _liquidType ? _liquidType[(x_int>>3)*16 + (y_int>>3)] : _liquidType; if (type == 0) return LIQUID_MAP_NO_WATER; @@ -1493,15 +1493,15 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R // Check water level: // Check water height map - int lx_int = x_int - m_liquid_offY; - int ly_int = y_int - m_liquid_offX; - if (lx_int < 0 || lx_int >=m_liquid_height) + int lx_int = x_int - _liquidOffY; + int ly_int = y_int - _liquidOffX; + if (lx_int < 0 || lx_int >=_liquidHeight) return LIQUID_MAP_NO_WATER; - if (ly_int < 0 || ly_int >=m_liquid_width) + if (ly_int < 0 || ly_int >=_liquidWidth) return LIQUID_MAP_NO_WATER; // Get water level - float liquid_level = m_liquid_map ? m_liquid_map[lx_int*m_liquid_width + ly_int] : m_liquidLevel; + float liquid_level = _liquidMap ? _liquidMap[lx_int*_liquidWidth + ly_int] : _liquidLevel; // Get ground level (sub 0.2 for fix some errors) float ground_level = getHeight(x, y); diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 148a55d4691..3b33f32e78b 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -143,55 +143,58 @@ struct LiquidData class GridMap { - uint32 m_flags; - // Area data - uint16 m_gridArea; - uint16 *m_area_map; - // Height level data - float m_gridHeight; - float m_gridIntHeightMultiplier; + uint32 _flags; union{ - float *m_V9; - uint16 *m_uint16_V9; - uint8 *m_uint8_V9; + float* m_V9; + uint16* m_uint16_V9; + uint8* m_uint8_V9; }; union{ - float *m_V8; - uint16 *m_uint16_V8; - uint8 *m_uint8_V8; + float* m_V8; + uint16* m_uint16_V8; + uint8* m_uint8_V8; }; + // Height level data + float _gridHeight; + float _gridIntHeightMultiplier; + + // Area data + uint16* _areaMap; + // Liquid data - uint16 m_liquidType; - uint8 m_liquid_offX; - uint8 m_liquid_offY; - uint8 m_liquid_width; - uint8 m_liquid_height; - float m_liquidLevel; - uint8 *m_liquid_type; - float *m_liquid_map; - - bool loadAreaData(FILE* in, uint32 offset, uint32 size); - bool loadHeihgtData(FILE* in, uint32 offset, uint32 size); - bool loadLiquidData(FILE* in, uint32 offset, uint32 size); + float _liquidLevel; + uint8* _liquidType; + float* _liquidMap; + uint16 _gridArea; + uint16 _liquidType; + uint8 _liquidOffX; + uint8 _liquidOffY; + uint8 _liquidWidth; + uint8 _liquidHeight; + + + bool loadAreaData(FILE* in, uint32 offset, uint32 size); + bool loadHeihgtData(FILE* in, uint32 offset, uint32 size); + bool loadLiquidData(FILE* in, uint32 offset, uint32 size); // Get height functions and pointers - typedef float (GridMap::*pGetHeightPtr) (float x, float y) const; - pGetHeightPtr m_gridGetHeight; - float getHeightFromFloat(float x, float y) const; - float getHeightFromUint16(float x, float y) const; - float getHeightFromUint8(float x, float y) const; - float getHeightFromFlat(float x, float y) const; + typedef float (GridMap::*GetHeightPtr) (float x, float y) const; + GetHeightPtr _gridGetHeight; + float getHeightFromFloat(float x, float y) const; + float getHeightFromUint16(float x, float y) const; + float getHeightFromUint8(float x, float y) const; + float getHeightFromFlat(float x, float y) const; public: GridMap(); ~GridMap(); - bool loadData(char *filaname); - void unloadData(); + bool loadData(char* filaname); + void unloadData(); uint16 getArea(float x, float y); - inline float getHeight(float x, float y) {return (this->*m_gridGetHeight)(x, y);} - float getLiquidLevel(float x, float y); - uint8 getTerrainType(float x, float y); + inline float getHeight(float x, float y) {return (this->*_gridGetHeight)(x, y);} + float getLiquidLevel(float x, float y); + uint8 getTerrainType(float x, float y); ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0); }; diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index c7cf9be9a38..954a193c498 100755 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -53,9 +53,9 @@ void MotionMaster::Initialize() // set new default movement generator void MotionMaster::InitDefault() { - if (i_owner->GetTypeId() == TYPEID_UNIT) + if (_owner->GetTypeId() == TYPEID_UNIT) { - MovementGenerator* movement = FactorySelector::selectMovementGenerator(i_owner->ToCreature()); + MovementGenerator* movement = FactorySelector::selectMovementGenerator(_owner->ToCreature()); Mutate(movement == NULL ? &si_idleMovement : movement, MOTION_SLOT_IDLE); } else @@ -77,42 +77,42 @@ MotionMaster::~MotionMaster() void MotionMaster::UpdateMotion(uint32 diff) { - if (!i_owner) + if (!_owner) return; - if (i_owner->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) // what about UNIT_STATE_DISTRACTED? Why is this not included? + if (_owner->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) // what about UNIT_STATE_DISTRACTED? Why is this not included? return; ASSERT(!empty()); - m_cleanFlag |= MMCF_UPDATE; - if (!top()->Update(*i_owner, diff)) + _cleanFlag |= MMCF_UPDATE; + if (!top()->Update(*_owner, diff)) { - m_cleanFlag &= ~MMCF_UPDATE; + _cleanFlag &= ~MMCF_UPDATE; MovementExpired(); } else - m_cleanFlag &= ~MMCF_UPDATE; + _cleanFlag &= ~MMCF_UPDATE; - if (m_expList) + if (_expList) { - for (size_t i = 0; i < m_expList->size(); ++i) + for (size_t i = 0; i < _expList->size(); ++i) { - MovementGenerator* mg = (*m_expList)[i]; + MovementGenerator* mg = (*_expList)[i]; DirectDelete(mg); } - delete m_expList; - m_expList = NULL; + delete _expList; + _expList = NULL; if (empty()) Initialize(); else if (needInitTop()) InitTop(); - else if (m_cleanFlag & MMCF_RESET) - top()->Reset(*i_owner); + else if (_cleanFlag & MMCF_RESET) + top()->Reset(*_owner); - m_cleanFlag &= ~MMCF_RESET; + _cleanFlag &= ~MMCF_RESET; } } @@ -128,7 +128,7 @@ void MotionMaster::DirectClean(bool reset) if (needInitTop()) InitTop(); else if (reset) - top()->Reset(*i_owner); + top()->Reset(*_owner); } void MotionMaster::DelayedClean() @@ -152,14 +152,14 @@ void MotionMaster::DirectExpire(bool reset) } while (!top()) - --i_top; + --_top; if (empty()) Initialize(); else if (needInitTop()) InitTop(); else if (reset) - top()->Reset(*i_owner); + top()->Reset(*_owner); } void MotionMaster::DelayedExpire() @@ -172,7 +172,7 @@ void MotionMaster::DelayedExpire() } while (!top()) - --i_top; + --_top; } void MotionMaster::MoveIdle() @@ -184,9 +184,9 @@ void MotionMaster::MoveIdle() void MotionMaster::MoveRandom(float spawndist) { - if (i_owner->GetTypeId() == TYPEID_UNIT) + if (_owner->GetTypeId() == TYPEID_UNIT) { - sLog->outStaticDebug("Creature (GUID: %u) start moving random", i_owner->GetGUIDLow()); + sLog->outStaticDebug("Creature (GUID: %u) start moving random", _owner->GetGUIDLow()); Mutate(new RandomMovementGenerator(spawndist), MOTION_SLOT_IDLE); } } @@ -195,15 +195,15 @@ void MotionMaster::MoveTargetedHome() { Clear(false); - if (i_owner->GetTypeId()==TYPEID_UNIT && !((Creature*)i_owner)->GetCharmerOrOwnerGUID()) + if (_owner->GetTypeId()==TYPEID_UNIT && !((Creature*)_owner)->GetCharmerOrOwnerGUID()) { - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted home", i_owner->GetEntry(), i_owner->GetGUIDLow()); + sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted home", _owner->GetEntry(), _owner->GetGUIDLow()); Mutate(new HomeMovementGenerator(), MOTION_SLOT_ACTIVE); } - else if (i_owner->GetTypeId()==TYPEID_UNIT && ((Creature*)i_owner)->GetCharmerOrOwnerGUID()) + else if (_owner->GetTypeId()==TYPEID_UNIT && ((Creature*)_owner)->GetCharmerOrOwnerGUID()) { - sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", i_owner->GetEntry(), i_owner->GetGUIDLow() ); - Unit *target = ((Creature*)i_owner)->GetCharmerOrOwner(); + sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow() ); + Unit *target = ((Creature*)_owner)->GetCharmerOrOwner(); if (target) { sLog->outStaticDebug("Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow() ); @@ -212,21 +212,21 @@ void MotionMaster::MoveTargetedHome() } else { - sLog->outError("Player (GUID: %u) attempt targeted home", i_owner->GetGUIDLow()); + sLog->outError("Player (GUID: %u) attempt targeted home", _owner->GetGUIDLow()); } } void MotionMaster::MoveConfused() { - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) move confused", i_owner->GetGUIDLow()); + sLog->outStaticDebug("Player (GUID: %u) move confused", _owner->GetGUIDLow()); Mutate(new ConfusedMovementGenerator(), MOTION_SLOT_CONTROLLED); } else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) move confused", - i_owner->GetEntry(), i_owner->GetGUIDLow()); + _owner->GetEntry(), _owner->GetGUIDLow()); Mutate(new ConfusedMovementGenerator(), MOTION_SLOT_CONTROLLED); } } @@ -234,14 +234,14 @@ void MotionMaster::MoveConfused() void MotionMaster::MoveChase(Unit* target, float dist, float angle) { // ignore movement request if target not exist - if (!target || target == i_owner || i_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) + if (!target || target == _owner || _owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) return; - //i_owner->ClearUnitState(UNIT_STATE_FOLLOW); - if (i_owner->GetTypeId() == TYPEID_PLAYER) + //_owner->ClearUnitState(UNIT_STATE_FOLLOW); + if (_owner->GetTypeId() == TYPEID_PLAYER) { sLog->outStaticDebug("Player (GUID: %u) chase to %s (GUID: %u)", - i_owner->GetGUIDLow(), + _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); Mutate(new ChaseMovementGenerator(*target,dist,angle), MOTION_SLOT_ACTIVE); @@ -249,7 +249,7 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle) else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), + _owner->GetEntry(), _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); Mutate(new ChaseMovementGenerator(*target,dist,angle), MOTION_SLOT_ACTIVE); @@ -259,13 +259,13 @@ void MotionMaster::MoveChase(Unit* target, float dist, float angle) void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlot slot) { // ignore movement request if target not exist - if (!target || target == i_owner || i_owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) + if (!target || target == _owner || _owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) return; - //i_owner->AddUnitState(UNIT_STATE_FOLLOW); - if (i_owner->GetTypeId() == TYPEID_PLAYER) + //_owner->AddUnitState(UNIT_STATE_FOLLOW); + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) follow to %s (GUID: %u)", i_owner->GetGUIDLow(), + sLog->outStaticDebug("Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); Mutate(new FollowMovementGenerator(*target,dist,angle), slot); @@ -273,7 +273,7 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), + _owner->GetEntry(), _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); Mutate(new FollowMovementGenerator(*target,dist,angle), slot); @@ -282,15 +282,15 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo void MotionMaster::MovePoint(uint32 id, float x, float y, float z) { - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), id, x, y, z); + sLog->outStaticDebug("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), id, x, y, z); Mutate(new PointMovementGenerator(id, x, y, z), MOTION_SLOT_ACTIVE); } else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), id, x, y, z); + _owner->GetEntry(), _owner->GetGUIDLow(), id, x, y, z); Mutate(new PointMovementGenerator(id, x, y, z), MOTION_SLOT_ACTIVE); } } @@ -300,9 +300,9 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed) float x, y, z; pos.GetPosition(x, y, z); - sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", i_owner->GetEntry(), id, x, y, z); + sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); - Movement::MoveSplineInit init(*i_owner); + Movement::MoveSplineInit init(*_owner); init.MoveTo(x,y,z); init.SetVelocity(speed); init.SetAnimation(Movement::ToGround); @@ -315,9 +315,9 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed) float x, y, z; pos.GetPosition(x, y, z); - sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", i_owner->GetEntry(), id, x, y, z); + sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); - Movement::MoveSplineInit init(*i_owner); + Movement::MoveSplineInit init(*_owner); init.MoveTo(x,y,z); init.SetVelocity(speed); init.SetAnimation(Movement::ToFly); @@ -328,44 +328,44 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed) void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ) { //this function may make players fall below map - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) return; float x, y, z; float moveTimeHalf = speedZ / Movement::gravity; float dist = 2 * moveTimeHalf * speedXY; - i_owner->GetNearPoint(i_owner, x, y, z, i_owner->GetObjectSize(), dist, i_owner->GetAngle(srcX, srcY) + M_PI); + _owner->GetNearPoint(_owner, x, y, z, _owner->GetObjectSize(), dist, _owner->GetAngle(srcX, srcY) + M_PI); MoveJump(x, y, z, speedXY, speedZ); } void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ) { //this function may make players fall below map - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) return; float x, y, z; float moveTimeHalf = speedZ / Movement::gravity; float dist = 2 * moveTimeHalf * speedXY; - i_owner->GetClosePoint(x, y, z, i_owner->GetObjectSize(), dist, angle); + _owner->GetClosePoint(x, y, z, _owner->GetObjectSize(), dist, angle); MoveJump(x, y, z, speedXY, speedZ); } void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id) { - sLog->outStaticDebug("Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z); + sLog->outStaticDebug("Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); float moveTimeHalf = speedZ / Movement::gravity; float max_height = -Movement::computeFallElevation(moveTimeHalf,false,-speedZ); - Movement::MoveSplineInit init(*i_owner); + Movement::MoveSplineInit init(*_owner); init.MoveTo(x,y,z); init.SetParabolic(max_height,0); init.SetVelocity(speedXY); init.Launch(); - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); else Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE); @@ -374,20 +374,20 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee void MotionMaster::MoveFall(uint32 id/*=0*/) { // use larger distance for vmap height search than in most other cases - float tz = i_owner->GetMap()->GetHeight(i_owner->GetPhaseMask(), i_owner->GetPositionX(), i_owner->GetPositionY(), i_owner->GetPositionZ(), true, MAX_FALL_DISTANCE); + float tz = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE); if (tz <= INVALID_HEIGHT) { sLog->outStaticDebug("MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).", - i_owner->GetMap()->GetId(), i_owner->GetPositionX(), i_owner->GetPositionX(), i_owner->GetPositionZ()); + _owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionX(), _owner->GetPositionZ()); return; } // Abort too if the ground is very near - if (fabs(i_owner->GetPositionZ() - tz) < 0.1f) + if (fabs(_owner->GetPositionZ() - tz) < 0.1f) return; - Movement::MoveSplineInit init(*i_owner); - init.MoveTo(i_owner->GetPositionX(), i_owner->GetPositionY(), tz); + Movement::MoveSplineInit init(*_owner); + init.MoveTo(_owner->GetPositionX(), _owner->GetPositionY(), tz); init.SetFall(); init.Launch(); Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); @@ -398,45 +398,45 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id) if (Impl[MOTION_SLOT_CONTROLLED] && Impl[MOTION_SLOT_CONTROLLED]->GetMovementGeneratorType() != DISTRACT_MOTION_TYPE) return; - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", i_owner->GetGUIDLow(), x, y, z); + sLog->outStaticDebug("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); Mutate(new PointMovementGenerator(id, x, y, z, speed), MOTION_SLOT_CONTROLLED); } else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z); + _owner->GetEntry(), _owner->GetGUIDLow(), x, y, z); Mutate(new PointMovementGenerator(id, x, y, z, speed), MOTION_SLOT_CONTROLLED); } } void MotionMaster::MoveSeekAssistance(float x, float y, float z) { - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outError("Player (GUID: %u) attempt to seek assistance", i_owner->GetGUIDLow()); + sLog->outError("Player (GUID: %u) attempt to seek assistance", _owner->GetGUIDLow()); } else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), x, y, z); - i_owner->AttackStop(); - i_owner->ToCreature()->SetReactState(REACT_PASSIVE); + _owner->GetEntry(), _owner->GetGUIDLow(), x, y, z); + _owner->AttackStop(); + _owner->ToCreature()->SetReactState(REACT_PASSIVE); Mutate(new AssistanceMovementGenerator(x, y, z), MOTION_SLOT_ACTIVE); } } void MotionMaster::MoveSeekAssistanceDistract(uint32 time) { - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outError("Player (GUID: %u) attempt to call distract after assistance", i_owner->GetGUIDLow()); + sLog->outError("Player (GUID: %u) attempt to call distract after assistance", _owner->GetGUIDLow()); } else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), time); + _owner->GetEntry(), _owner->GetGUIDLow(), time); Mutate(new AssistanceDistractMovementGenerator(time), MOTION_SLOT_ACTIVE); } } @@ -446,12 +446,12 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time) if (!enemy) return; - if (i_owner->HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) + if (_owner->HasAuraType(SPELL_AURA_PREVENTS_FLEEING)) return; - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) flee from %s (GUID: %u)", i_owner->GetGUIDLow(), + sLog->outStaticDebug("Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow()); Mutate(new FleeingMovementGenerator(enemy->GetGUID()), MOTION_SLOT_CONTROLLED); @@ -459,7 +459,7 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time) else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s", - i_owner->GetEntry(), i_owner->GetGUIDLow(), + _owner->GetEntry(), _owner->GetGUIDLow(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow(), time ? " for a limited time" : ""); @@ -472,24 +472,24 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time) void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode) { - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { if (path < sTaxiPathNodesByPath.size()) { - sLog->outStaticDebug("%s taxi to (Path %u node %u)", i_owner->GetName(), path, pathnode); + sLog->outStaticDebug("%s taxi to (Path %u node %u)", _owner->GetName(), path, pathnode); FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(sTaxiPathNodesByPath[path], pathnode); Mutate(mgen, MOTION_SLOT_CONTROLLED); } else { sLog->outError("%s attempt taxi to (not existed Path %u node %u)", - i_owner->GetName(), path, pathnode); + _owner->GetName(), path, pathnode); } } else { sLog->outError("Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), path, pathnode); + _owner->GetEntry(), _owner->GetGUIDLow(), path, pathnode); } } @@ -498,14 +498,14 @@ void MotionMaster::MoveDistract(uint32 timer) if (Impl[MOTION_SLOT_CONTROLLED]) return; - if (i_owner->GetTypeId() == TYPEID_PLAYER) + if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outStaticDebug("Player (GUID: %u) distracted (timer: %u)", i_owner->GetGUIDLow(), timer); + sLog->outStaticDebug("Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer); } else { sLog->outStaticDebug("Creature (Entry: %u GUID: %u) (timer: %u)", - i_owner->GetEntry(), i_owner->GetGUIDLow(), timer); + _owner->GetEntry(), _owner->GetGUIDLow(), timer); } DistractMovementGenerator* mgen = new DistractMovementGenerator(timer); @@ -517,23 +517,23 @@ void MotionMaster::Mutate(MovementGenerator *m, MovementSlot slot) if (MovementGenerator *curr = Impl[slot]) { Impl[slot] = NULL; // in case a new one is generated in this slot during directdelete - if (i_top == slot && (m_cleanFlag & MMCF_UPDATE)) + if (_top == slot && (_cleanFlag & MMCF_UPDATE)) DelayedDelete(curr); else DirectDelete(curr); } - else if (i_top < slot) + else if (_top < slot) { - i_top = slot; + _top = slot; } Impl[slot] = m; - if (i_top > slot) - needInit[slot] = true; + if (_top > slot) + _needInit[slot] = true; else { - needInit[slot] = false; - m->Initialize(*i_owner); + _needInit[slot] = false; + m->Initialize(*_owner); } } @@ -546,19 +546,19 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable) /*while (!empty()) { MovementGenerator *curr = top(); - curr->Finalize(*i_owner); + curr->Finalize(*_owner); pop(); if (!isStatic(curr)) delete curr; }*/ - //i_owner->GetTypeId() == TYPEID_PLAYER ? + //_owner->GetTypeId() == TYPEID_PLAYER ? //Mutate(new WaypointMovementGenerator(path_id, repeatable)): Mutate(new WaypointMovementGenerator(path_id, repeatable), MOTION_SLOT_IDLE); sLog->outStaticDebug("%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)", - i_owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature", - i_owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO"); + _owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature", + _owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO"); } void MotionMaster::MoveRotate(uint32 time, RotateDirection direction) @@ -576,7 +576,7 @@ void MotionMaster::propagateSpeedChange() { (*it)->unitSpeedChanged(); }*/ - for (int i = 0; i <= i_top; ++i) + for (int i = 0; i <= _top; ++i) { if (Impl[i]) Impl[i]->unitSpeedChanged(); @@ -601,34 +601,34 @@ MovementGeneratorType MotionMaster::GetMotionSlotType(int slot) const void MotionMaster::InitTop() { - top()->Initialize(*i_owner); - needInit[i_top] = false; + top()->Initialize(*_owner); + _needInit[_top] = false; } void MotionMaster::DirectDelete(_Ty curr) { if (isStatic(curr)) return; - curr->Finalize(*i_owner); + curr->Finalize(*_owner); delete curr; } void MotionMaster::DelayedDelete(_Ty curr) { - sLog->outCrash("Unit (Entry %u) is trying to delete its updating MG (Type %u)!", i_owner->GetEntry(), curr->GetMovementGeneratorType()); + sLog->outCrash("Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType()); if (isStatic(curr)) return; - if (!m_expList) - m_expList = new ExpireList(); - m_expList->push_back(curr); + if (!_expList) + _expList = new ExpireList(); + _expList->push_back(curr); } bool MotionMaster::GetDestination(float &x, float &y, float &z) { - if (i_owner->movespline->Finalized()) + if (_owner->movespline->Finalized()) return false; - const G3D::Vector3& dest = i_owner->movespline->FinalDestination(); + const G3D::Vector3& dest = _owner->movespline->FinalDestination(); x = dest.x; y = dest.y; z = dest.z; diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index a5bd0861b04..d9f38242922 100755 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -82,25 +82,21 @@ class MotionMaster //: private std::stack { private: //typedef std::stack Impl; - typedef MovementGenerator* _Ty; - _Ty Impl[MAX_MOTION_SLOT]; - bool needInit[MAX_MOTION_SLOT]; typedef std::vector<_Ty> ExpireList; - int i_top; - void pop() { Impl[i_top] = NULL; --i_top; } - void push(_Ty _Val) { ++i_top; Impl[i_top] = _Val; } + void pop() { Impl[_top] = NULL; --_top; } + void push(_Ty _Val) { ++_top; Impl[_top] = _Val; } - bool needInitTop() const { return needInit[i_top]; } + bool needInitTop() const { return _needInit[_top]; } void InitTop(); public: - explicit MotionMaster(Unit* unit) : i_top(-1), i_owner(unit), m_expList(NULL), m_cleanFlag(MMCF_NONE) + explicit MotionMaster(Unit* unit) : _top(-1), _owner(unit), _expList(NULL), _cleanFlag(MMCF_NONE) { for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i) { Impl[i] = NULL; - needInit[i] = true; + _needInit[i] = true; } } ~MotionMaster(); @@ -108,9 +104,9 @@ class MotionMaster //: private std::stack void Initialize(); void InitDefault(); - bool empty() const { return (i_top < 0); } - int size() const { return i_top + 1; } - _Ty top() const { return Impl[i_top]; } + bool empty() const { return (_top < 0); } + int size() const { return _top + 1; } + _Ty top() const { return Impl[_top]; } _Ty GetMotionSlot(int slot) const { return Impl[slot]; } void DirectDelete(_Ty curr); @@ -119,12 +115,12 @@ class MotionMaster //: private std::stack void UpdateMotion(uint32 diff); void Clear(bool reset = true) { - if (m_cleanFlag & MMCF_UPDATE) + if (_cleanFlag & MMCF_UPDATE) { if (reset) - m_cleanFlag |= MMCF_RESET; + _cleanFlag |= MMCF_RESET; else - m_cleanFlag &= ~MMCF_RESET; + _cleanFlag &= ~MMCF_RESET; DelayedClean(); } else @@ -132,12 +128,12 @@ class MotionMaster //: private std::stack } void MovementExpired(bool reset = true) { - if (m_cleanFlag & MMCF_UPDATE) + if (_cleanFlag & MMCF_UPDATE) { if (reset) - m_cleanFlag |= MMCF_RESET; + _cleanFlag |= MMCF_RESET; else - m_cleanFlag &= ~MMCF_RESET; + _cleanFlag &= ~MMCF_RESET; DelayedExpire(); } else @@ -187,9 +183,13 @@ class MotionMaster //: private std::stack void DirectExpire(bool reset); void DelayedExpire(); - Unit *i_owner; - ExpireList* m_expList; - uint8 m_cleanFlag; + ExpireList* _expList; + typedef MovementGenerator* _Ty; + _Ty Impl[MAX_MOTION_SLOT]; + int _top; + Unit* _owner; + bool _needInit[MAX_MOTION_SLOT]; + uint8 _cleanFlag; }; #endif diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index a235991e6b4..eaaaeaac9ca 100755 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -360,17 +360,17 @@ class Quest struct QuestStatusData { - QuestStatusData(): m_status(QUEST_STATUS_NONE), m_explored(false), m_timer(0), m_playercount(0) + QuestStatusData(): Status(QUEST_STATUS_NONE), Explored(false), Timer(0), PlayerCount(0) { - memset(m_itemcount, 0, QUEST_ITEM_OBJECTIVES_COUNT * sizeof(uint16)); - memset(m_creatureOrGOcount, 0, QUEST_OBJECTIVES_COUNT * sizeof(uint16)); + memset(ItemCount, 0, QUEST_ITEM_OBJECTIVES_COUNT * sizeof(uint16)); + memset(CreatureOrGOCount, 0, QUEST_OBJECTIVES_COUNT * sizeof(uint16)); } - QuestStatus m_status; - bool m_explored; - uint32 m_timer; - uint16 m_itemcount[QUEST_ITEM_OBJECTIVES_COUNT]; - uint16 m_creatureOrGOcount[QUEST_OBJECTIVES_COUNT]; - uint16 m_playercount; + QuestStatus Status; + uint32 Timer; + uint16 ItemCount[QUEST_ITEM_OBJECTIVES_COUNT]; + uint16 CreatureOrGOCount[QUEST_OBJECTIVES_COUNT]; + uint16 PlayerCount; + bool Explored; }; #endif diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index d988959f890..b1f38dfb86d 100755 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -45,7 +45,7 @@ bool ReputationMgr::IsAtWar(uint32 faction_id) const if (!factionEntry) { - sLog->outError("ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", m_player->GetName(), faction_id); + sLog->outError("ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", _player->GetName(), faction_id); return 0; } @@ -68,7 +68,7 @@ int32 ReputationMgr::GetReputation(uint32 faction_id) const if (!factionEntry) { - sLog->outError("ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", m_player->GetName(), faction_id); + sLog->outError("ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", _player->GetName(), faction_id); return 0; } @@ -80,8 +80,8 @@ int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const if (!factionEntry) return 0; - uint32 raceMask = m_player->getRaceMask(); - uint32 classMask = m_player->getClassMask(); + uint32 raceMask = _player->getRaceMask(); + uint32 classMask = _player->getClassMask(); for (int i=0; i < 4; i++) { if ((factionEntry->BaseRepRaceMask[i] & raceMask || @@ -124,9 +124,9 @@ ReputationRank ReputationMgr::GetBaseRank(FactionEntry const* factionEntry) cons void ReputationMgr::ApplyForceReaction(uint32 faction_id, ReputationRank rank, bool apply) { if (apply) - m_forcedReactions[faction_id] = rank; + _forcedReactions[faction_id] = rank; else - m_forcedReactions.erase(faction_id); + _forcedReactions.erase(faction_id); } uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) const @@ -134,8 +134,8 @@ uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) con if (!factionEntry) return 0; - uint32 raceMask = m_player->getRaceMask(); - uint32 classMask = m_player->getClassMask(); + uint32 raceMask = _player->getRaceMask(); + uint32 classMask = _player->getClassMask(); for (int i=0; i < 4; i++) { if ((factionEntry->BaseRepRaceMask[i] & raceMask || @@ -152,14 +152,14 @@ uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) con void ReputationMgr::SendForceReactions() { WorldPacket data; - data.Initialize(SMSG_SET_FORCED_REACTIONS, 4+m_forcedReactions.size()*(4+4)); - data << uint32(m_forcedReactions.size()); - for (ForcedReactions::const_iterator itr = m_forcedReactions.begin(); itr != m_forcedReactions.end(); ++itr) + data.Initialize(SMSG_SET_FORCED_REACTIONS, 4+_forcedReactions.size()*(4+4)); + data << uint32(_forcedReactions.size()); + for (ForcedReactions::const_iterator itr = _forcedReactions.begin(); itr != _forcedReactions.end(); ++itr) { data << uint32(itr->first); // faction_id (Faction.dbc) data << uint32(itr->second); // reputation rank } - m_player->SendDirectMessage(&data); + _player->SendDirectMessage(&data); } void ReputationMgr::SendState(FactionState const* faction) @@ -176,7 +176,7 @@ void ReputationMgr::SendState(FactionState const* faction) data << (uint32) faction->ReputationListID; data << (uint32) faction->Standing; - for (FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr) + for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr) { if (itr->second.needSend) { @@ -191,7 +191,7 @@ void ReputationMgr::SendState(FactionState const* faction) } data.put(p_count, count); - m_player->SendDirectMessage(&data); + _player->SendDirectMessage(&data); } void ReputationMgr::SendInitialReputations() @@ -201,7 +201,7 @@ void ReputationMgr::SendInitialReputations() RepListID a = 0; - for (FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr) + for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr) { // fill in absent fields for (; a != itr->first; a++) @@ -226,33 +226,33 @@ void ReputationMgr::SendInitialReputations() data << uint32 (0x00000000); } - m_player->SendDirectMessage(&data); + _player->SendDirectMessage(&data); } void ReputationMgr::SendStates() { - for (FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr) + for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr) SendState(&(itr->second)); } void ReputationMgr::SendVisible(FactionState const* faction) const { - if (m_player->GetSession()->PlayerLoading()) + if (_player->GetSession()->PlayerLoading()) return; // make faction visible in reputation list at client WorldPacket data(SMSG_SET_FACTION_VISIBLE, 4); data << faction->ReputationListID; - m_player->SendDirectMessage(&data); + _player->SendDirectMessage(&data); } void ReputationMgr::Initialize() { - m_factions.clear(); - m_visibleFactionCount = 0; - m_honoredFactionCount = 0; - m_reveredFactionCount = 0; - m_exaltedFactionCount = 0; + _factions.clear(); + _visibleFactionCount = 0; + _honoredFactionCount = 0; + _reveredFactionCount = 0; + _exaltedFactionCount = 0; for (unsigned int i = 1; i < sFactionStore.GetNumRows(); i++) { @@ -269,18 +269,18 @@ void ReputationMgr::Initialize() newFaction.needSave = true; if (newFaction.Flags & FACTION_FLAG_VISIBLE) - ++m_visibleFactionCount; + ++_visibleFactionCount; UpdateRankCounters(REP_HOSTILE, GetBaseRank(factionEntry)); - m_factions[newFaction.ReputationListID] = newFaction; + _factions[newFaction.ReputationListID] = newFaction; } } } bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental) { - sScriptMgr->OnPlayerReputationChange(m_player, factionEntry->ID, standing, incremental); + sScriptMgr->OnPlayerReputationChange(_player, factionEntry->ID, standing, incremental); bool res = false; // if spillover definition exists in DB, override DBC if (const RepSpilloverTemplate* repTemplate = sObjectMgr->GetRepSpilloverTemplate(factionEntry->ID)) @@ -289,7 +289,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi { if (repTemplate->faction[i]) { - if (m_player->GetReputationRank(repTemplate->faction[i]) <= ReputationRank(repTemplate->faction_rank[i])) + if (_player->GetReputationRank(repTemplate->faction[i]) <= ReputationRank(repTemplate->faction_rank[i])) { // bonuses are already given, so just modify standing by rate int32 spilloverRep = int32(standing * repTemplate->faction_rate[i]); @@ -309,9 +309,9 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi spillOverRepOut *= factionEntry->spilloverRateOut; if (FactionEntry const* parent = sFactionStore.LookupEntry(factionEntry->team)) { - FactionStateList::iterator parentState = m_factions.find(parent->reputationListID); + FactionStateList::iterator parentState = _factions.find(parent->reputationListID); // some team factions have own reputation standing, in this case do not spill to other sub-factions - if (parentState != m_factions.end() && (parentState->second.Flags & FACTION_FLAG_SPECIAL)) + if (parentState != _factions.end() && (parentState->second.Flags & FACTION_FLAG_SPECIAL)) { SetOneFactionReputation(parent, int32(spillOverRepOut), incremental); } @@ -338,8 +338,8 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi } } // spillover done, update faction itself - FactionStateList::iterator faction = m_factions.find(factionEntry->reputationListID); - if (faction != m_factions.end()) + FactionStateList::iterator faction = _factions.find(factionEntry->reputationListID); + if (faction != _factions.end()) { res = SetOneFactionReputation(factionEntry, standing, incremental); // only this faction gets reported to client, even if it has no own visible standing @@ -350,8 +350,8 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, int32 standing, bool incremental) { - FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID); - if (itr != m_factions.end()) + FactionStateList::iterator itr = _factions.find(factionEntry->reputationListID); + if (itr != _factions.end()) { int32 BaseRep = GetBaseReputation(factionEntry); @@ -381,12 +381,12 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in UpdateRankCounters(old_rank, new_rank); - m_player->ReputationChanged(factionEntry); - m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS, factionEntry->ID); - m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID); - m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, factionEntry->ID); - m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION, factionEntry->ID); - m_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID); + _player->ReputationChanged(factionEntry); + _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_KNOWN_FACTIONS, factionEntry->ID); + _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION, factionEntry->ID); + _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION, factionEntry->ID); + _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_REVERED_REPUTATION, factionEntry->ID); + _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID); return true; } @@ -400,7 +400,7 @@ void ReputationMgr::SetVisible(FactionTemplateEntry const*factionTemplateEntry) if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction)) // Never show factions of the opposing team - if (!(factionEntry->BaseRepRaceMask[1] & m_player->getRaceMask() && factionEntry->BaseRepValue[1] == Reputation_Bottom)) + if (!(factionEntry->BaseRepRaceMask[1] & _player->getRaceMask() && factionEntry->BaseRepValue[1] == Reputation_Bottom)) SetVisible(factionEntry); } @@ -409,8 +409,8 @@ void ReputationMgr::SetVisible(FactionEntry const* factionEntry) if (factionEntry->reputationListID < 0) return; - FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID); - if (itr == m_factions.end()) + FactionStateList::iterator itr = _factions.find(factionEntry->reputationListID); + if (itr == _factions.end()) return; SetVisible(&itr->second); @@ -431,15 +431,15 @@ void ReputationMgr::SetVisible(FactionState* faction) faction->needSend = true; faction->needSave = true; - ++m_visibleFactionCount; + ++_visibleFactionCount; SendVisible(faction); } void ReputationMgr::SetAtWar(RepListID repListID, bool on) { - FactionStateList::iterator itr = m_factions.find(repListID); - if (itr == m_factions.end()) + FactionStateList::iterator itr = _factions.find(repListID); + if (itr == _factions.end()) return; // always invisible or hidden faction can't change war state @@ -470,8 +470,8 @@ void ReputationMgr::SetAtWar(FactionState* faction, bool atWar) const void ReputationMgr::SetInactive(RepListID repListID, bool on) { - FactionStateList::iterator itr = m_factions.find(repListID); - if (itr == m_factions.end()) + FactionStateList::iterator itr = _factions.find(repListID); + if (itr == _factions.end()) return; SetInactive(&itr->second, on); @@ -512,7 +512,7 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result) FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt16()); if (factionEntry && (factionEntry->reputationListID >= 0)) { - FactionState* faction = &m_factions[factionEntry->reputationListID]; + FactionState* faction = &_factions[factionEntry->reputationListID]; // update standing to current faction->Standing = int32(fields[1].GetUInt32()); @@ -558,12 +558,12 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result) void ReputationMgr::SaveToDB(SQLTransaction& trans) { - for (FactionStateList::iterator itr = m_factions.begin(); itr != m_factions.end(); ++itr) + for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr) { if (itr->second.needSave) { - trans->PAppend("DELETE FROM character_reputation WHERE guid = '%u' AND faction='%u'", m_player->GetGUIDLow(), itr->second.ID); - trans->PAppend("INSERT INTO character_reputation (guid, faction, standing, flags) VALUES ('%u', '%u', '%i', '%u')", m_player->GetGUIDLow(), itr->second.ID, itr->second.Standing, itr->second.Flags); + trans->PAppend("DELETE FROM character_reputation WHERE guid = '%u' AND faction='%u'", _player->GetGUIDLow(), itr->second.ID); + trans->PAppend("INSERT INTO character_reputation (guid, faction, standing, flags) VALUES ('%u', '%u', '%i', '%u')", _player->GetGUIDLow(), itr->second.ID, itr->second.Standing, itr->second.Flags); itr->second.needSave = false; } } @@ -572,16 +572,16 @@ void ReputationMgr::SaveToDB(SQLTransaction& trans) void ReputationMgr::UpdateRankCounters(ReputationRank old_rank, ReputationRank new_rank) { if (old_rank >= REP_EXALTED) - --m_exaltedFactionCount; + --_exaltedFactionCount; if (old_rank >= REP_REVERED) - --m_reveredFactionCount; + --_reveredFactionCount; if (old_rank >= REP_HONORED) - --m_honoredFactionCount; + --_honoredFactionCount; if (new_rank >= REP_EXALTED) - ++m_exaltedFactionCount; + ++_exaltedFactionCount; if (new_rank >= REP_REVERED) - ++m_reveredFactionCount; + ++_reveredFactionCount; if (new_rank >= REP_HONORED) - ++m_honoredFactionCount; + ++_honoredFactionCount; } diff --git a/src/server/game/Reputation/ReputationMgr.h b/src/server/game/Reputation/ReputationMgr.h index b73574d288f..84013f7ec20 100755 --- a/src/server/game/Reputation/ReputationMgr.h +++ b/src/server/game/Reputation/ReputationMgr.h @@ -50,8 +50,8 @@ struct FactionState { uint32 ID; RepListID ReputationListID; - uint8 Flags; int32 Standing; + uint8 Flags; bool needSend; bool needSave; }; @@ -64,8 +64,8 @@ class Player; class ReputationMgr { public: // constructors and global modifiers - explicit ReputationMgr(Player* owner) : m_player(owner), - m_visibleFactionCount(0), m_honoredFactionCount(0), m_reveredFactionCount(0), m_exaltedFactionCount(0) {} + explicit ReputationMgr(Player* owner) : _player(owner), + _visibleFactionCount(0), _honoredFactionCount(0), _reveredFactionCount(0), _exaltedFactionCount(0) {} ~ReputationMgr() {} void SaveToDB(SQLTransaction& trans); @@ -77,12 +77,12 @@ class ReputationMgr static ReputationRank ReputationToRank(int32 standing); public: // accessors - uint8 GetVisibleFactionCount() const { return m_visibleFactionCount; } - uint8 GetHonoredFactionCount() const { return m_honoredFactionCount; } - uint8 GetReveredFactionCount() const { return m_reveredFactionCount; } - uint8 GetExaltedFactionCount() const { return m_exaltedFactionCount; } + uint8 GetVisibleFactionCount() const { return _visibleFactionCount; } + uint8 GetHonoredFactionCount() const { return _honoredFactionCount; } + uint8 GetReveredFactionCount() const { return _reveredFactionCount; } + uint8 GetExaltedFactionCount() const { return _exaltedFactionCount; } - FactionStateList const& GetStateList() const { return m_factions; } + FactionStateList const& GetStateList() const { return _factions; } FactionState const* GetState(FactionEntry const* factionEntry) const { @@ -91,8 +91,8 @@ class ReputationMgr FactionState const* GetState(RepListID id) const { - FactionStateList::const_iterator repItr = m_factions.find (id); - return repItr != m_factions.end() ? &repItr->second : NULL; + FactionStateList::const_iterator repItr = _factions.find (id); + return repItr != _factions.end() ? &repItr->second : NULL; } bool IsAtWar(uint32 faction_id) const; @@ -111,8 +111,8 @@ class ReputationMgr ReputationRank const* GetForcedRankIfAny(FactionTemplateEntry const* factionTemplateEntry) const { - ForcedReactions::const_iterator forceItr = m_forcedReactions.find(factionTemplateEntry->faction); - return forceItr != m_forcedReactions.end() ? &forceItr->second : NULL; + ForcedReactions::const_iterator forceItr = _forcedReactions.find(factionTemplateEntry->faction); + return forceItr != _forcedReactions.end() ? &forceItr->second : NULL; } public: // modifiers @@ -149,13 +149,13 @@ class ReputationMgr void SendVisible(FactionState const* faction) const; void UpdateRankCounters(ReputationRank old_rank, ReputationRank new_rank); private: - Player* m_player; - FactionStateList m_factions; - ForcedReactions m_forcedReactions; - uint8 m_visibleFactionCount :8; - uint8 m_honoredFactionCount :8; - uint8 m_reveredFactionCount :8; - uint8 m_exaltedFactionCount :8; + Player* _player; + FactionStateList _factions; + ForcedReactions _forcedReactions; + uint8 _visibleFactionCount :8; + uint8 _honoredFactionCount :8; + uint8 _reveredFactionCount :8; + uint8 _exaltedFactionCount :8; }; #endif diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index f993ed6843c..47751338d66 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -1040,7 +1040,7 @@ bool ScriptMgr::OnConditionCheck(Condition* condition, ConditionSourceInfo& sour { ASSERT(condition); - GET_SCRIPT_RET(ConditionScript, condition->mScriptId, tmpscript, true); + GET_SCRIPT_RET(ConditionScript, condition->ScriptId, tmpscript, true); return tmpscript->OnConditionCheck(condition, sourceInfo); } diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 31dd3ad7471..490f33f46e1 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -95,18 +95,19 @@ class AuraEffect Aura* const m_base; SpellInfo const* const m_spellInfo; - uint8 const m_effIndex; int32 const m_baseAmount; int32 m_amount; - bool m_canBeRecalculated; SpellModifier* m_spellmod; - bool m_isPeriodic; int32 m_periodicTimer; int32 m_amplitude; uint32 m_tickNumber; + + uint8 const m_effIndex; + bool m_canBeRecalculated; + bool m_isPeriodic; private: bool IsPeriodicTickCrit(Unit* target, Unit const* caster) const; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index d49ac829ef9..4bc193b49d2 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -37,8 +37,8 @@ #include "Vehicle.h" AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura* aura, uint8 effMask): -m_target(target), m_base(aura), m_slot(MAX_AURAS), m_flags(AFLAG_NONE), -m_effectsToApply(effMask), m_removeMode(AURA_REMOVE_NONE), m_needClientUpdate(false) +_target(target), _base(aura), _slot(MAX_AURAS), _flags(AFLAG_NONE), +_effectsToApply(effMask), _removeMode(AURA_REMOVE_NONE), _needClientUpdate(false) { ASSERT(GetTarget() && GetBase()); @@ -70,7 +70,7 @@ m_effectsToApply(effMask), m_removeMode(AURA_REMOVE_NONE), m_needClientUpdate(fa // Register Visible Aura if (slot < MAX_AURAS) { - m_slot = slot; + _slot = slot; GetTarget()->SetVisibleAura(slot, this); SetNeedClientUpdate(); sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Aura: %u Effect: %d put to unit visible auras slot: %u", GetBase()->GetId(), GetEffectMask(), slot); @@ -89,7 +89,7 @@ void AuraApplication::_Remove() if (slot >= MAX_AURAS) return; - if (AuraApplication * foundAura = m_target->GetAuraApplication(GetBase()->GetId(), GetBase()->GetCasterGUID(), GetBase()->GetCastItemGUID())) + if (AuraApplication * foundAura = _target->GetAuraApplication(GetBase()->GetId(), GetBase()->GetCasterGUID(), GetBase()->GetCastItemGUID())) { // Reuse visible aura slot by aura which is still applied - prevent storing dead pointers if (slot == foundAura->GetSlot()) @@ -115,7 +115,7 @@ void AuraApplication::_Remove() void AuraApplication::_InitFlags(Unit* caster, uint8 effMask) { // mark as selfcasted if needed - m_flags |= (GetBase()->GetCasterGUID() == GetTarget()->GetGUID()) ? AFLAG_CASTER : AFLAG_NONE; + _flags |= (GetBase()->GetCasterGUID() == GetTarget()->GetGUID()) ? AFLAG_CASTER : AFLAG_NONE; // aura is casted by self or an enemy // one negative effect and we know aura is negative @@ -130,7 +130,7 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask) break; } } - m_flags |= negativeFound ? AFLAG_NEGATIVE : AFLAG_POSITIVE; + _flags |= negativeFound ? AFLAG_NEGATIVE : AFLAG_POSITIVE; } // aura is casted by friend // one positive effect and we know aura is positive @@ -145,7 +145,7 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask) break; } } - m_flags |= positiveFound ? AFLAG_POSITIVE : AFLAG_NEGATIVE; + _flags |= positiveFound ? AFLAG_POSITIVE : AFLAG_NEGATIVE; } } @@ -154,19 +154,19 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply) AuraEffect* aurEff = GetBase()->GetEffect(effIndex); ASSERT(aurEff); ASSERT(HasEffect(effIndex) == (!apply)); - ASSERT((1<outDebug(LOG_FILTER_SPELLS_AURAS, "AuraApplication::_HandleEffect: %u, apply: %u: amount: %u", aurEff->GetAuraType(), apply, aurEff->GetAmount()); if (apply) { - ASSERT(!(m_flags & (1<HandleEffect(this, AURA_EFFECT_HANDLE_REAL, true); } else { - ASSERT(m_flags & (1<HandleEffect(this, AURA_EFFECT_HANDLE_REAL, false); // Remove all triggered by aura spells vs unlimited duration @@ -177,19 +177,19 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply) void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const { - data << uint8(m_slot); + data << uint8(_slot); if (remove) { - ASSERT(!m_target->GetVisibleAura(m_slot)); + ASSERT(!_target->GetVisibleAura(_slot)); data << uint32(0); return; } - ASSERT(m_target->GetVisibleAura(m_slot)); + ASSERT(_target->GetVisibleAura(_slot)); Aura const* aura = GetBase(); data << uint32(aura->GetId()); - uint32 flags = m_flags; + uint32 flags = _flags; if (aura->GetMaxDuration() > 0 && !(aura->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_HIDE_DURATION)) flags |= AFLAG_DURATION; data << uint8(flags); @@ -210,13 +210,13 @@ void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const void AuraApplication::ClientUpdate(bool remove) { - m_needClientUpdate = false; + _needClientUpdate = false; WorldPacket data(SMSG_AURA_UPDATE); data.append(GetTarget()->GetPackGUID()); BuildUpdatePacket(data, remove); - m_target->SendMessageToSet(&data, true); + _target->SendMessageToSet(&data, true); } uint8 Aura::BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleEffectMask, WorldObject* owner) diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 4d87abccda3..0af8d132211 100755 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -46,13 +46,13 @@ class AuraApplication friend void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode); friend AuraApplication * Unit::_CreateAuraApplication(Aura* aura, uint8 effMask); private: - Unit* const m_target; - Aura* const m_base; - uint8 m_slot; // Aura slot on unit - uint8 m_flags; // Aura info flag - uint8 m_effectsToApply; // Used only at spell hit to determine which effect should be applied - AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason - bool m_needClientUpdate:1; + Unit* const _target; + Aura* const _base; + AuraRemoveMode _removeMode:8; // Store info for know remove aura reason + uint8 _slot; // Aura slot on unit + uint8 _flags; // Aura info flag + uint8 _effectsToApply; // Used only at spell hit to determine which effect should be applied + bool _needClientUpdate:1; explicit AuraApplication(Unit* target, Unit* caster, Aura* base, uint8 effMask); void _Remove(); @@ -61,22 +61,22 @@ class AuraApplication void _HandleEffect(uint8 effIndex, bool apply); public: - Unit* GetTarget() const { return m_target; } - Aura* GetBase() const { return m_base; } + Unit* GetTarget() const { return _target; } + Aura* GetBase() const { return _base; } - uint8 GetSlot() const { return m_slot; } - uint8 GetFlags() const { return m_flags; } - uint8 GetEffectMask() const { return m_flags & (AFLAG_EFF_INDEX_0 | AFLAG_EFF_INDEX_1 | AFLAG_EFF_INDEX_2); } - bool HasEffect(uint8 effect) const { ASSERT(effect < MAX_SPELL_EFFECTS); return m_flags & (1<ToPlayer()) { if (playerCaster->GetSession() && condInfo.mLastFailedCondition - && condInfo.mLastFailedCondition->ErrorTextd) - playerCaster->GetSession()->SendNotification(condInfo.mLastFailedCondition->ErrorTextd); + && condInfo.mLastFailedCondition->ErrorTextId) + playerCaster->GetSession()->SendNotification(condInfo.mLastFailedCondition->ErrorTextId); } return SPELL_FAILED_DONT_REPORT; } diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index 40e1051f218..79e8da6fd77 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -551,7 +551,7 @@ public: return; QuestStatusMap::const_iterator itr = caster->ToPlayer()->getQuestStatusMap().find(QUEST_ENTRY); - if (itr->second.m_status != QUEST_STATUS_INCOMPLETE) + if (itr->second.Status != QUEST_STATUS_INCOMPLETE) return; for (uint8 i=0; i<3; i++) @@ -575,7 +575,7 @@ public: break; } - if (itr->second.m_creatureOrGOcount[i] != 0) + if (itr->second.CreatureOrGOCount[i] != 0) continue; caster->ToPlayer()->KilledMonsterCredit(me->GetEntry(), 0); diff --git a/src/server/shared/Database/QueryResult.cpp b/src/server/shared/Database/QueryResult.cpp index dff055b8d3d..95034387089 100755 --- a/src/server/shared/Database/QueryResult.cpp +++ b/src/server/shared/Database/QueryResult.cpp @@ -20,13 +20,13 @@ #include "Log.h" ResultSet::ResultSet(MYSQL_RES *result, MYSQL_FIELD *fields, uint64 rowCount, uint32 fieldCount) : -m_rowCount(rowCount), -m_fieldCount(fieldCount), -m_result(result), -m_fields(fields) +_rowCount(rowCount), +_fieldCount(fieldCount), +_result(result), +_fields(fields) { - m_currentRow = new Field[m_fieldCount]; - ASSERT(m_currentRow); + _currentRow = new Field[_fieldCount]; + ASSERT(_currentRow); } PreparedResultSet::PreparedResultSet(MYSQL_STMT* stmt, MYSQL_RES *result, uint64 rowCount, uint32 fieldCount) : @@ -150,18 +150,18 @@ bool ResultSet::NextRow() { MYSQL_ROW row; - if (!m_result) + if (!_result) return false; - row = mysql_fetch_row(m_result); + row = mysql_fetch_row(_result); if (!row) { CleanUp(); return false; } - for (uint32 i = 0; i < m_fieldCount; i++) - m_currentRow[i].SetStructuredValue(row[i], m_fields[i].type); + for (uint32 i = 0; i < _fieldCount; i++) + _currentRow[i].SetStructuredValue(row[i], _fields[i].type); return true; } @@ -196,16 +196,16 @@ bool PreparedResultSet::_NextRow() void ResultSet::CleanUp() { - if (m_currentRow) + if (_currentRow) { - delete [] m_currentRow; - m_currentRow = NULL; + delete [] _currentRow; + _currentRow = NULL; } - if (m_result) + if (_result) { - mysql_free_result(m_result); - m_result = NULL; + mysql_free_result(_result); + _result = NULL; } } diff --git a/src/server/shared/Database/QueryResult.h b/src/server/shared/Database/QueryResult.h index c165a9456f5..524532f30ec 100755 --- a/src/server/shared/Database/QueryResult.h +++ b/src/server/shared/Database/QueryResult.h @@ -33,29 +33,29 @@ class ResultSet { public: - ResultSet(MYSQL_RES *result, MYSQL_FIELD *fields, uint64 rowCount, uint32 fieldCount); + ResultSet(MYSQL_RES* result, MYSQL_FIELD* fields, uint64 rowCount, uint32 fieldCount); ~ResultSet(); bool NextRow(); - uint64 GetRowCount() const { return m_rowCount; } - uint32 GetFieldCount() const { return m_fieldCount; } + uint64 GetRowCount() const { return _rowCount; } + uint32 GetFieldCount() const { return _fieldCount; } - Field* Fetch() const { return m_currentRow; } + Field* Fetch() const { return _currentRow; } const Field & operator [] (uint32 index) const { - ASSERT(index < m_fieldCount); - return m_currentRow[index]; + ASSERT(index < _fieldCount); + return _currentRow[index]; } protected: - Field* m_currentRow; - uint64 m_rowCount; - uint32 m_fieldCount; + uint64 _rowCount; + Field* _currentRow; + uint32 _fieldCount; private: void CleanUp(); - MYSQL_RES *m_result; - MYSQL_FIELD *m_fields; + MYSQL_RES* _result; + MYSQL_FIELD* _fields; }; typedef ACE_Refcounted_Auto_Ptr QueryResult; @@ -63,7 +63,7 @@ typedef ACE_Refcounted_Auto_Ptr QueryResult; class PreparedResultSet { public: - PreparedResultSet(MYSQL_STMT* stmt, MYSQL_RES *result, uint64 rowCount, uint32 fieldCount); + PreparedResultSet(MYSQL_STMT* stmt, MYSQL_RES* result, uint64 rowCount, uint32 fieldCount); ~PreparedResultSet(); bool NextRow(); @@ -84,9 +84,9 @@ class PreparedResultSet } protected: + std::vector m_rows; uint64 m_rowCount; uint64 m_rowPosition; - std::vector m_rows; uint32 m_fieldCount; private: -- cgit v1.2.3 From c8d9e30d6eb6c535e77c337ac2f68388da250856 Mon Sep 17 00:00:00 2001 From: Go6o Date: Tue, 14 Feb 2012 21:51:54 +0200 Subject: Volunteer's Work - fix by Vincent-Michael --- .../scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp index 4e1b9da0adb..2789bc48a4c 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp @@ -402,7 +402,8 @@ public: if (!CAST_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok) CAST_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerokFail = true; - boss->AI()->DoAction(ACTION_INITIAND_KILLED); + if (Killer->GetTypeId() == TYPEID_PLAYER) + boss->AI()->DoAction(ACTION_INITIAND_KILLED); } instance->SetData64(DATA_ADD_JEDOGA_OPFER, 0); -- cgit v1.2.3 From 9ead33ff023838ec587331b037c60c7567e7ee69 Mon Sep 17 00:00:00 2001 From: w1sht0l1v3 Date: Tue, 14 Feb 2012 21:57:20 +0200 Subject: Scripts/Trial of the Crusader: Removed "Touch of Jaraxxus" ability from Lord Jaraxxus's Script. --- .../TrialOfTheCrusader/boss_lord_jaraxxus.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index fc01ad2efea..6cd049967c1 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -68,7 +68,6 @@ enum BossSpells { SPELL_LEGION_FLAME = 66197, // player should run away from raid because he triggers Legion Flame SPELL_LEGION_FLAME_EFFECT = 66201, // used by trigger npc - SPELL_TOUCH_OF_JARAXXUS = 66209, // used only in 25H SPELL_NETHER_POWER = 66228, // +20% of spell damage per stack, stackable up to 5/10 times, must be dispelled/stealed SPELL_FEL_LIGHTING = 66528, // jumps to nearby targets SPELL_FEL_FIREBALL = 66532, // does heavy damage to the tank, interruptable @@ -120,7 +119,6 @@ public: uint32 m_uiIncinerateFleshTimer; uint32 m_uiNetherPowerTimer; uint32 m_uiLegionFlameTimer; - uint32 m_uiTouchOfJaraxxusTimer; uint32 m_uiSummonNetherPortalTimer; uint32 m_uiSummonInfernalEruptionTimer; @@ -134,7 +132,6 @@ public: m_uiIncinerateFleshTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS); m_uiNetherPowerTimer = 40*IN_MILLISECONDS; m_uiLegionFlameTimer = 30*IN_MILLISECONDS; - m_uiTouchOfJaraxxusTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); m_uiSummonNetherPortalTimer = 1*MINUTE*IN_MILLISECONDS; m_uiSummonInfernalEruptionTimer = 2*MINUTE*IN_MILLISECONDS; Summons.DespawnAll(); @@ -240,13 +237,6 @@ public: m_uiLegionFlameTimer = 30*IN_MILLISECONDS; } else m_uiLegionFlameTimer -= uiDiff; - if (GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC && m_uiTouchOfJaraxxusTimer <= uiDiff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_TOUCH_OF_JARAXXUS); - m_uiTouchOfJaraxxusTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); - } else m_uiTouchOfJaraxxusTimer -= uiDiff; - DoMeleeAttackIfReady(); } }; -- cgit v1.2.3 From 210fa7743d72f7a91d65826db5aa9596604cf54f Mon Sep 17 00:00:00 2001 From: QAston Date: Wed, 15 Feb 2012 23:48:01 +0100 Subject: Scripts/Auras: fix spell_trash_mob_glacial_strike script, original patch by cemak. Closes #5196. --- src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index 25cd292d390..a91951ca25e 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -289,7 +289,7 @@ class spell_trash_mob_glacial_strike : public SpellScriptLoader { if (GetTarget()->IsFullHealth()) { - GetTarget()->RemoveAura(GetId(), AURA_REMOVE_BY_ENEMY_SPELL); + GetTarget()->RemoveAura(GetId(), 0, 0, AURA_REMOVE_BY_ENEMY_SPELL); PreventDefaultAction(); } } -- cgit v1.2.3 From ccb80da1e1bc3fe88b2209117473670a2bebd915 Mon Sep 17 00:00:00 2001 From: Anubisss Date: Wed, 15 Feb 2012 19:57:57 -0500 Subject: Fixed crash in the Twin Valkyrs encounter in ToC. closes #4915 --- .../CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index c1009963df0..a78a29704cc 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -562,11 +562,13 @@ struct mob_unleashed_ballAI : public ScriptedAI { float x0 = ToCCommonLoc[1].GetPositionX(), y0 = ToCCommonLoc[1].GetPositionY(), r = 47.0f; float y = y0; - float x = float(urand(uint32(x0 - r), uint32(x0 + r))); + float x = frand(x0 - r, x0 + r); + float sq = pow(r, 2) - pow(x - x0, 2); + float rt = sqrtf(fabs(sq)); if (urand(0, 1)) - y = y0 + sqrt(pow(r, 2) - pow((x-x0), 2)); + y = y0 + rt; else - y = y0 - sqrt(pow(r, 2) - pow((x-x0), 2)); + y = y0 - rt; me->GetMotionMaster()->MovePoint(0, x, y, me->GetPositionZ()); } -- cgit v1.2.3 From 03c34ee507b4e43fabee1ff382d9de9ea815e3f2 Mon Sep 17 00:00:00 2001 From: Spp Date: Thu, 16 Feb 2012 13:56:08 +0100 Subject: Fix a lot of warnings --- src/server/authserver/Server/RealmSocket.cpp | 2 +- src/server/authserver/Server/RealmSocket.h | 2 +- .../collision/BoundingIntervalHierarchyWrapper.h | 4 ++-- src/server/collision/DynamicTree.cpp | 5 +++-- src/server/collision/Maps/TileAssembler.cpp | 9 ++++----- src/server/collision/Models/GameObjectModel.cpp | 20 +++++++++----------- src/server/collision/RegularGrid.h | 4 ++-- src/server/game/Conditions/ConditionMgr.cpp | 5 ++--- src/server/game/Conditions/ConditionMgr.h | 7 ++++--- src/server/game/Entities/Creature/Creature.cpp | 2 +- src/server/game/Entities/GameObject/GameObject.cpp | 2 +- src/server/game/Entities/Player/Player.cpp | 9 ++++----- src/server/game/Entities/Unit/Unit.cpp | 16 ++++++++-------- src/server/game/Entities/Vehicle/VehicleDefines.h | 2 +- src/server/game/Groups/Group.cpp | 2 +- src/server/game/Instances/InstanceScript.cpp | 2 +- src/server/game/Loot/LootMgr.cpp | 6 +++--- src/server/game/Maps/Map.cpp | 2 +- src/server/game/Movement/MotionMaster.h | 2 +- .../MovementGenerators/HomeMovementGenerator.cpp | 2 +- .../MovementGenerators/PointMovementGenerator.cpp | 2 +- .../MovementGenerators/RandomMovementGenerator.cpp | 3 +-- .../MovementGenerators/TargetedMovementGenerator.h | 5 +++-- .../MovementGenerators/WaypointMovementGenerator.cpp | 4 ++-- .../MovementGenerators/WaypointMovementGenerator.h | 5 +++-- src/server/game/Movement/Spline/MoveSpline.cpp | 2 +- src/server/game/Movement/Spline/MoveSpline.h | 2 -- src/server/game/Movement/Spline/MoveSplineFlag.h | 16 ++++++++-------- src/server/game/Movement/Spline/Spline.cpp | 2 -- src/server/game/Movement/Spline/Spline.h | 6 +----- src/server/game/Quests/QuestDef.h | 2 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 6 +++--- src/server/game/Spells/Auras/SpellAuras.cpp | 4 ++-- src/server/game/Spells/Spell.cpp | 2 +- src/server/scripts/Commands/cs_debug.cpp | 2 +- .../TrialOfTheCrusader/boss_twin_valkyr.cpp | 2 +- src/server/scripts/Outland/blades_edge_mountains.cpp | 6 ++---- src/server/scripts/Spells/spell_generic.cpp | 10 ++++++---- 38 files changed, 88 insertions(+), 98 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/authserver/Server/RealmSocket.cpp b/src/server/authserver/Server/RealmSocket.cpp index 72c36fc6646..e839457d1c9 100755 --- a/src/server/authserver/Server/RealmSocket.cpp +++ b/src/server/authserver/Server/RealmSocket.cpp @@ -95,7 +95,7 @@ const std::string& RealmSocket::getRemoteAddress(void) const return _remoteAddress; } -const uint16 RealmSocket::getRemotePort(void) const +uint16 RealmSocket::getRemotePort(void) const { return _remotePort; } diff --git a/src/server/authserver/Server/RealmSocket.h b/src/server/authserver/Server/RealmSocket.h index 9dbd0a4aafb..c03a0e3ad1e 100755 --- a/src/server/authserver/Server/RealmSocket.h +++ b/src/server/authserver/Server/RealmSocket.h @@ -55,7 +55,7 @@ public: const std::string& getRemoteAddress(void) const; - const uint16 getRemotePort(void) const; + uint16 getRemotePort(void) const; virtual int open(void *); diff --git a/src/server/collision/BoundingIntervalHierarchyWrapper.h b/src/server/collision/BoundingIntervalHierarchyWrapper.h index e54a4e653a1..e2252ca60c8 100644 --- a/src/server/collision/BoundingIntervalHierarchyWrapper.h +++ b/src/server/collision/BoundingIntervalHierarchyWrapper.h @@ -34,7 +34,7 @@ class BIHWrap const T* const* objects; RayCallback& _callback; - MDLCallback(RayCallback& callback, const T* const* objects_array ) : _callback(callback), objects(objects_array){} + MDLCallback(RayCallback& callback, const T* const* objects_array ) : objects(objects_array), _callback(callback) {} bool operator() (const Ray& ray, uint32 Idx, float& MaxDist, bool /*stopAtFirst*/) { @@ -106,4 +106,4 @@ public: } }; -#endif // _BIH_WRAP \ No newline at end of file +#endif // _BIH_WRAP diff --git a/src/server/collision/DynamicTree.cpp b/src/server/collision/DynamicTree.cpp index 89e76d426fe..ebb46614a20 100644 --- a/src/server/collision/DynamicTree.cpp +++ b/src/server/collision/DynamicTree.cpp @@ -43,10 +43,11 @@ template<> struct BoundsTrait< GameObjectModel> { static void getBounds2(const GameObjectModel* g, G3D::AABox& out) { out = g->getBounds();} }; +/* static bool operator == (const GameObjectModel& mdl, const GameObjectModel& mdl2){ return &mdl == &mdl2; } - +*/ int valuesPerNode = 5, numMeanSplits = 3; @@ -251,4 +252,4 @@ float DynamicMapTree::getHeight(float x, float y, float z, float maxSearchDist, return v.z - maxSearchDist; else return -G3D::inf(); -} \ No newline at end of file +} diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp index 62968e4dedd..cfd50c318df 100644 --- a/src/server/collision/Maps/TileAssembler.cpp +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -344,16 +344,15 @@ namespace VMAP char buff[500]; while (!feof(model_list)) { - fread(&displayId,sizeof(uint32),1,model_list); - fread(&name_length,sizeof(uint32),1,model_list); - - if (name_length >= sizeof(buff)) + if (fread(&displayId, sizeof(uint32), 1, model_list) != 1 + || fread(&name_length, sizeof(uint32), 1, model_list) != 1 + || name_length >= sizeof(buff) + || fread(&buff, sizeof(char), name_length, model_list) != name_length) { std::cout << "\nFile 'temp_gameobject_models' seems to be corrupted" << std::endl; break; } - fread(&buff,sizeof(char),name_length,model_list); std::string model_name(buff, name_length); WorldModel_Raw raw_model; diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index 5ad984fcb4b..4c0a344f868 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -36,7 +36,7 @@ using G3D::AABox; struct GameobjectModelData { GameobjectModelData(const std::string& name_, const AABox& box) : - name(name_), bound(box) {} + bound(box), name(name_) {} AABox bound; std::string name; @@ -55,20 +55,18 @@ void LoadGameObjectModelList() char buff[500]; while (!feof(model_list_file)) { - fread(&displayId,sizeof(uint32),1,model_list_file); - fread(&name_length,sizeof(uint32),1,model_list_file); - - if (name_length >= sizeof(buff)) + Vector3 v1, v2; + if (fread(&displayId, sizeof(uint32), 1, model_list_file) != 1 + || fread(&name_length, sizeof(uint32), 1, model_list_file) != 1 + || name_length >= sizeof(buff) + || fread(&buff, sizeof(char), name_length, model_list_file) != name_length + || fread(&v1, sizeof(Vector3), 1, model_list_file) != 1 + || fread(&v2, sizeof(Vector3), 1, model_list_file) != 1) { printf("\nFile '%s' seems to be corrupted", VMAP::GAMEOBJECT_MODELS); break; } - fread(&buff, sizeof(char), name_length,model_list_file); - Vector3 v1, v2; - fread(&v1, sizeof(Vector3), 1, model_list_file); - fread(&v2, sizeof(Vector3), 1, model_list_file); - model_list.insert ( ModelList::value_type( displayId, GameobjectModelData(std::string(buff,name_length),AABox(v1,v2)) ) @@ -172,4 +170,4 @@ bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool Sto MaxDist = distance; } return hit; -} \ No newline at end of file +} diff --git a/src/server/collision/RegularGrid.h b/src/server/collision/RegularGrid.h index be61504bc65..2c11b1c257d 100644 --- a/src/server/collision/RegularGrid.h +++ b/src/server/collision/RegularGrid.h @@ -17,7 +17,7 @@ using G3D::Ray; template struct NodeCreator{ - static Node * makeNode(int x, int y) { return new Node();} + static Node * makeNode(int /*x*/, int /*y*/) { return new Node();} }; templateSourceGroup && (*itr).second.text_id == cond->SourceEntry) + if ((*itr).second.entry == cond->SourceGroup && (*itr).second.text_id == uint32(cond->SourceEntry)) { (*itr).second.conditions.push_back(cond); return true; @@ -743,7 +742,7 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond) { for (GossipMenuItemsContainer::iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr) { - if ((*itr).second.MenuId == cond->SourceGroup && (*itr).second.OptionIndex == cond->SourceEntry) + if ((*itr).second.MenuId == cond->SourceGroup && (*itr).second.OptionIndex == uint32(cond->SourceEntry)) { (*itr).second.Conditions.push_back(cond); return true; diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 3c968998566..79a2122ae29 100755 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -255,10 +255,11 @@ template bool CompareValues(ComparisionType type, T val1, T val2) return val1 >= val2; case COMP_TYPE_LOW_EQ: return val1 <= val2; + default: + // incorrect parameter + ASSERT(false); + return false; } - // incorrect parameter - ASSERT(false); - return false; } #define sConditionMgr ACE_Singleton::instance() diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index cbd0922118c..d40ee89e774 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -145,7 +145,7 @@ m_PlayerDamageReq(0), m_lootMoney(0), m_lootRecipient(0), m_lootRecipientGroup(0 m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), -m_creatureInfo(NULL), m_creatureData(NULL), m_formation(NULL), m_path_id(0) +m_creatureInfo(NULL), m_creatureData(NULL), m_path_id(0), m_formation(NULL) { m_regenTimer = CREATURE_REGEN_INTERVAL; m_valuesCount = UNIT_END; diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 41e0b8e054b..a06cee891e7 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -33,7 +33,7 @@ #include "GameObjectModel.h" #include "DynamicTree.h" -GameObject::GameObject() : WorldObject(false), m_goValue(new GameObjectValue), m_AI(NULL), m_model(NULL) +GameObject::GameObject() : WorldObject(false), m_model(NULL), m_goValue(new GameObjectValue), m_AI(NULL) { m_objectType |= TYPEMASK_GAMEOBJECT; m_objectTypeId = TYPEID_GAMEOBJECT; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 80511f49a64..941d898c1fb 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -434,9 +434,9 @@ void TradeData::SetAccepted(bool state, bool crosssend /*= false*/) // 5. Credit instance encounter. KillRewarder::KillRewarder(Player* killer, Unit* victim, bool isBattleGround) : // 1. Initialize internal variables to default values. - _killer(killer), _victim(victim), _isBattleGround(isBattleGround), - _isPvP(false), _group(killer->GetGroup()), _groupRate(1.0f), - _maxLevel(0), _maxNotGrayMember(NULL), _count(0), _sumLevel(0), _isFullXP(false), _xp(0) + _killer(killer), _victim(victim), _group(killer->GetGroup()), + _groupRate(1.0f), _maxNotGrayMember(NULL), _count(0), _sumLevel(0), _xp(0), + _isFullXP(false), _maxLevel(0), _isBattleGround(isBattleGround), _isPvP(false) { // mark the credit as pvp if victim is player if (victim->GetTypeId() == TYPEID_PLAYER) @@ -11830,7 +11830,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje Map const* map = lootedObject->GetMap(); if (uint32 dungeonId = sLFGMgr->GetDungeon(GetGroup()->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) - if (dungeon->map == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) lootedObjectInDungeon = true; if (!lootedObjectInDungeon) @@ -12024,7 +12024,6 @@ Item* Player::StoreItem(ItemPosCountVec const& dest, Item* pItem, bool update) return NULL; Item* lastItem = pItem; - uint32 entry = pItem->GetEntry(); for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end();) { uint16 pos = itr->pos; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 04eab0b7d56..183267d1dbf 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -146,9 +146,10 @@ _hitMask(hitMask), _spell(spell), _damageInfo(damageInfo), _healInfo(healInfo) #endif Unit::Unit(bool isWorldObject): WorldObject(isWorldObject), m_movedPlayer(NULL), m_lastSanctuaryTime(0), IsAIEnabled(false), NeedChangeAI(false), -m_ControlledByPlayer(false), i_AI(NULL), i_disabledAI(NULL), m_procDeep(0), -m_removedAurasCount(0), i_motionMaster(this), m_ThreatManager(this), m_vehicle(NULL), -m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this), movespline(new Movement::MoveSpline()) +m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(NULL), +i_disabledAI(NULL), m_procDeep(0), m_removedAurasCount(0), i_motionMaster(this), +m_ThreatManager(this), m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), +m_HostileRefManager(this) { #ifdef _MSC_VER #pragma warning(default:4355) @@ -7010,8 +7011,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot())); if ((attType != BASE_ATTACK && attType != OFF_ATTACK) - || attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK - || attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK) + || (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK) + || (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)) return false; // Now compute real proc chance... @@ -7307,8 +7308,8 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere Player* player = ToPlayer(); WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot())); if ((attType != BASE_ATTACK && attType != OFF_ATTACK) - || attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK - || attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK) + || (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK) + || (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)) return false; float fire_onhit = float(CalculatePctF(dummySpell->Effects[EFFECT_0]. CalcValue(), 1.0f)); @@ -12685,7 +12686,6 @@ void Unit::setDeathState(DeathState s) { // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that // it can be used to check creation of death items (such as soul shards). - DeathState oldDeathState = m_deathState; m_deathState = s; if (s != ALIVE && s != JUST_ALIVED) diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h index 57d9204ad1c..df34a61d444 100644 --- a/src/server/game/Entities/Vehicle/VehicleDefines.h +++ b/src/server/game/Entities/Vehicle/VehicleDefines.h @@ -63,7 +63,7 @@ struct VehicleSeat struct VehicleAccessory { VehicleAccessory(uint32 entry, int8 seatId, bool isMinion, uint8 summonType, uint32 summonTime) : - AccessoryEntry(entry), SeatId(seatId), IsMinion(isMinion), SummonedType(summonType), SummonTime(summonTime) {} + AccessoryEntry(entry), IsMinion(isMinion), SummonTime(summonTime), SeatId(seatId), SummonedType(summonType) {} uint32 AccessoryEntry; uint32 IsMinion; uint32 SummonTime; diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index b31b632e963..b24b5be014a 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -554,7 +554,7 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV { Player* Leader = ObjectAccessor::FindPlayer(GetLeaderGUID()); LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(sLFGMgr->GetDungeon(GetGUID())); - if ((Leader && dungeon && Leader->isAlive() && Leader->GetMapId() != dungeon->map) || !dungeon) + if ((Leader && dungeon && Leader->isAlive() && Leader->GetMapId() != uint32(dungeon->map)) || !dungeon) { Disband(); return false; diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index 90fb8ffb9f0..c6a93ff4272 100755 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -316,7 +316,7 @@ void InstanceScript::DoSendNotifyToInstance(char const* format, ...) for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) if (Player* player = i->getSource()) if (WorldSession* session = player->GetSession()) - session->SendNotification(buff); + session->SendNotification("%s", buff); } } diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 564d0cce8b7..64e9b9a27e4 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -1364,7 +1364,7 @@ bool LootTemplate::addConditionItem(Condition* cond) { for (LootStoreItemList::iterator i = Entries.begin(); i != Entries.end(); ++i) { - if (i->itemid == cond->SourceEntry) + if (i->itemid == uint32(cond->SourceEntry)) { i->conditions.push_back(cond); return true; @@ -1380,7 +1380,7 @@ bool LootTemplate::addConditionItem(Condition* cond) { for (LootStoreItemList::iterator i = itemList->begin(); i != itemList->end(); ++i) { - if ((*i).itemid == cond->SourceEntry) + if ((*i).itemid == uint32(cond->SourceEntry)) { (*i).conditions.push_back(cond); return true; @@ -1392,7 +1392,7 @@ bool LootTemplate::addConditionItem(Condition* cond) { for (LootStoreItemList::iterator i = itemList->begin(); i != itemList->end(); ++i) { - if ((*i).itemid == cond->SourceEntry) + if ((*i).itemid == uint32(cond->SourceEntry)) { (*i).conditions.push_back(cond); return true; diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 39f695c0868..7f7612c2046 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2374,7 +2374,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) if (LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin()))) - if (dungeon->map == GetId() && dungeon->difficulty == GetDifficulty() && randomDungeon->type == LFG_TYPE_RANDOM) + if (uint32(dungeon->map) == GetId() && dungeon->difficulty == GetDifficulty() && randomDungeon->type == LFG_TYPE_RANDOM) player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true); } diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 83ff81ab30b..9910f8ad40a 100755 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -91,7 +91,7 @@ class MotionMaster //: private std::stack void InitTop(); public: - explicit MotionMaster(Unit* unit) : _top(-1), _owner(unit), _expList(NULL), _cleanFlag(MMCF_NONE) + explicit MotionMaster(Unit* unit) : _expList(NULL), _top(-1), _owner(unit), _cleanFlag(MMCF_NONE) { for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i) { diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp index dc47898352e..5725aec54f6 100755 --- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp @@ -57,7 +57,7 @@ void HomeMovementGenerator::_setTargetLocation(Creature & owner) owner.ClearUnitState(UNIT_STATE_ALL_STATE & ~UNIT_STATE_EVADE); } -bool HomeMovementGenerator::Update(Creature &owner, const uint32 time_diff) +bool HomeMovementGenerator::Update(Creature &owner, const uint32 /*time_diff*/) { arrived = owner.movespline->Finalized(); return !arrived; diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp index 02f9ebce847..c565e150740 100755 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp @@ -41,7 +41,7 @@ void PointMovementGenerator::Initialize(T &unit) } template -bool PointMovementGenerator::Update(T &unit, const uint32 &diff) +bool PointMovementGenerator::Update(T &unit, const uint32 & /*diff*/) { if (!&unit) return false; diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp index 054f87d9fff..b65fa210723 100755 --- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp @@ -35,9 +35,8 @@ template<> void RandomMovementGenerator::_setRandomLocation(Creature& creature) { - float respX, respY, respZ, respO, currZ, destX, destY, destZ, travelDistZ; + float respX, respY, respZ, respO, destX, destY, destZ, travelDistZ; creature.GetHomePosition(respX, respY, respZ, respO); - currZ = creature.GetPositionZ(); Map const* map = creature.GetBaseMap(); // For 2D/3D system selection diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h index bf2eecc89f6..b851dbc0e05 100755 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h @@ -39,8 +39,9 @@ class TargetedMovementGeneratorMedium { protected: TargetedMovementGeneratorMedium(Unit &target, float offset, float angle) : - TargetedMovementGeneratorBase(target), i_offset(offset), i_angle(angle), - i_recalculateTravel(false), i_targetReached(false), i_recheckDistance(0) + TargetedMovementGeneratorBase(target), i_recheckDistance(0), + i_offset(offset), i_angle(angle), + i_recalculateTravel(false), i_targetReached(false) { } ~TargetedMovementGeneratorMedium() {} diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index da84325a00a..1871454d614 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -78,7 +78,7 @@ void WaypointMovementGenerator::OnArrived(Creature& creature) if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance) { - sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Creature movement start script %u at point %u for %u.", i_path->at(i_currentNode)->event_id, i_currentNode, creature.GetGUID()); + sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Creature movement start script %u at point %u for "UI64FMTD".", i_path->at(i_currentNode)->event_id, i_currentNode, creature.GetGUID()); creature.GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, &creature, NULL/*, false*/); } @@ -240,7 +240,7 @@ void FlightPathMovementGenerator::Reset(Player & player) init.Launch(); } -bool FlightPathMovementGenerator::Update(Player &player, const uint32 diff) +bool FlightPathMovementGenerator::Update(Player &player, const uint32 /*diff*/) { uint32 pointId = (uint32)player.movespline->currentPathIdx(); if (pointId > i_currentNode) diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h index aa6d327db3b..9c2475267f6 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h @@ -42,7 +42,7 @@ template class PathMovementBase { public: - PathMovementBase() : i_currentNode(0), i_path(NULL) {} + PathMovementBase() : i_path(NULL), i_currentNode(0) {} virtual ~PathMovementBase() {}; // template pattern, not defined .. override required @@ -63,7 +63,8 @@ class WaypointMovementGenerator public PathMovementBase { public: - WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true) : i_nextMoveTime(0), path_id(_path_id), m_isArrivalDone(false), repeating(_repeating) {} + WaypointMovementGenerator(uint32 _path_id = 0, bool _repeating = true) + : i_nextMoveTime(0), m_isArrivalDone(false), path_id(_path_id), repeating(_repeating) {} ~WaypointMovementGenerator() { i_path = NULL; } void Initialize(Creature &); void Finalize(Creature &); diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index 4eaa6b57b36..5d0344f9769 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -187,7 +187,7 @@ void MoveSpline::Initialize(const MoveSplineInitArgs& args) } MoveSpline::MoveSpline() : m_Id(0), time_passed(0), - vertical_acceleration(0.f), effect_start_time(0), point_Idx(0), point_Idx_offset(0), initialOrientation(0.f) + vertical_acceleration(0.f), initialOrientation(0.f), effect_start_time(0), point_Idx(0), point_Idx_offset(0) { splineflags.done = true; } diff --git a/src/server/game/Movement/Spline/MoveSpline.h b/src/server/game/Movement/Spline/MoveSpline.h index 4b8dbcc8ee3..d4b19b21634 100644 --- a/src/server/game/Movement/Spline/MoveSpline.h +++ b/src/server/game/Movement/Spline/MoveSpline.h @@ -47,7 +47,6 @@ namespace Movement Result_NextCycle = 0x04, Result_NextSegment = 0x08, }; - #pragma region fields friend class PacketBuilder; protected: MySpline spline; @@ -88,7 +87,6 @@ namespace Movement void _Finalize(); void _Interrupt() { splineflags.done = true;} - #pragma endregion public: void Initialize(const MoveSplineInitArgs&); diff --git a/src/server/game/Movement/Spline/MoveSplineFlag.h b/src/server/game/Movement/Spline/MoveSplineFlag.h index de91f63c30a..33973064e09 100644 --- a/src/server/game/Movement/Spline/MoveSplineFlag.h +++ b/src/server/game/Movement/Spline/MoveSplineFlag.h @@ -98,14 +98,14 @@ namespace Movement void operator &= (uint32 f) { raw() &= f;} void operator |= (uint32 f) { raw() |= f;} - void EnableAnimation(uint8 anim) { raw() = raw() & ~(Mask_Animations|Falling|Parabolic) | Animation|anim;} - void EnableParabolic() { raw() = raw() & ~(Mask_Animations|Falling|Animation) | Parabolic;} - void EnableFalling() { raw() = raw() & ~(Mask_Animations|Parabolic|Animation) | Falling;} - void EnableFlying() { raw() = raw() & ~Catmullrom | Flying; } - void EnableCatmullRom() { raw() = raw() & ~Flying | Catmullrom; } - void EnableFacingPoint() { raw() = raw() & ~Mask_Final_Facing | Final_Point;} - void EnableFacingAngle() { raw() = raw() & ~Mask_Final_Facing | Final_Angle;} - void EnableFacingTarget() { raw() = raw() & ~Mask_Final_Facing | Final_Target;} + void EnableAnimation(uint8 anim) { raw() = (raw() & ~(Mask_Animations|Falling|Parabolic)) | Animation|anim;} + void EnableParabolic() { raw() = (raw() & ~(Mask_Animations|Falling|Animation)) | Parabolic;} + void EnableFalling() { raw() = (raw() & ~(Mask_Animations|Parabolic|Animation)) | Falling;} + void EnableFlying() { raw() = (raw() & ~Catmullrom) | Flying; } + void EnableCatmullRom() { raw() = (raw() & ~Flying) | Catmullrom; } + void EnableFacingPoint() { raw() = (raw() & ~Mask_Final_Facing) | Final_Point;} + void EnableFacingAngle() { raw() = (raw() & ~Mask_Final_Facing) | Final_Angle;} + void EnableFacingTarget() { raw() = (raw() & ~Mask_Final_Facing) | Final_Target;} uint8 animId : 8; bool done : 1; diff --git a/src/server/game/Movement/Spline/Spline.cpp b/src/server/game/Movement/Spline/Spline.cpp index 14c1bd0c117..6970acf5415 100644 --- a/src/server/game/Movement/Spline/Spline.cpp +++ b/src/server/game/Movement/Spline/Spline.cpp @@ -56,7 +56,6 @@ SplineBase::InitMethtod SplineBase::initializers[SplineBase::ModesEnd] = }; /////////// -#pragma region evaluation methtods using G3D::Matrix4; static const Matrix4 s_catmullRomCoeffs( @@ -199,7 +198,6 @@ float SplineBase::SegLengthBezier3(index_type index) const } return length; } -#pragma endregion void SplineBase::init_spline(const Vector3 * controls, index_type count, EvaluationMode m) { diff --git a/src/server/game/Movement/Spline/Spline.h b/src/server/game/Movement/Spline/Spline.h index 28876b220d4..627cdcf3e3b 100644 --- a/src/server/game/Movement/Spline/Spline.h +++ b/src/server/game/Movement/Spline/Spline.h @@ -39,7 +39,6 @@ public: ModesEnd }; - #pragma region fields protected: ControlArray points; @@ -84,10 +83,9 @@ protected: void UninitializedSpline() const { ASSERT(false);} - #pragma endregion public: - explicit SplineBase() : m_mode(UninitializedMode), index_lo(0), index_hi(0), cyclic(false) {} + explicit SplineBase() : index_lo(0), index_hi(0), m_mode(UninitializedMode), cyclic(false) {} /** Caclulates the position for given segment Idx, and percent of segment length t @param t - percent of segment length, assumes that t in range [0, 1] @@ -138,13 +136,11 @@ class Spline : public SplineBase public: typedef length_type LengthType; typedef std::vector LengthArray; - #pragma region fields protected: LengthArray lengths; index_type computeIndexInBounds(length_type length) const; - #pragma endregion public: explicit Spline(){} diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index eaaaeaac9ca..21b98ad2cea 100755 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -360,7 +360,7 @@ class Quest struct QuestStatusData { - QuestStatusData(): Status(QUEST_STATUS_NONE), Explored(false), Timer(0), PlayerCount(0) + QuestStatusData(): Status(QUEST_STATUS_NONE), Timer(0), PlayerCount(0), Explored(false) { memset(ItemCount, 0, QUEST_ITEM_OBJECTIVES_COUNT * sizeof(uint16)); memset(CreatureOrGOCount, 0, QUEST_OBJECTIVES_COUNT * sizeof(uint16)); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 1972b625a9f..73039d15620 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -373,10 +373,10 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= }; AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32 *baseAmount, Unit* caster): -m_base(base), m_spellInfo(base->GetSpellInfo()), m_effIndex(effIndex), +m_base(base), m_spellInfo(base->GetSpellInfo()), m_baseAmount(baseAmount ? *baseAmount : m_spellInfo->Effects[m_effIndex].BasePoints), -m_canBeRecalculated(true), m_spellmod(NULL), m_isPeriodic(false), -m_periodicTimer(0), m_tickNumber(0) +m_spellmod(NULL), m_periodicTimer(0), m_tickNumber(0), m_effIndex(effIndex), +m_canBeRecalculated(true), m_isPeriodic(false) { CalculatePeriodic(caster, true, false); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 4bc193b49d2..ee5827cdb98 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -37,8 +37,8 @@ #include "Vehicle.h" AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura* aura, uint8 effMask): -_target(target), _base(aura), _slot(MAX_AURAS), _flags(AFLAG_NONE), -_effectsToApply(effMask), _removeMode(AURA_REMOVE_NONE), _needClientUpdate(false) +_target(target), _base(aura), _removeMode(AURA_REMOVE_NONE), _slot(MAX_AURAS), +_flags(AFLAG_NONE), _effectsToApply(effMask), _needClientUpdate(false) { ASSERT(GetTarget() && GetBase()); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6cacf5e7e5a..cc159a613c3 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4651,7 +4651,7 @@ SpellCastResult Spell::CheckCast(bool strict) Unit::AuraEffectList const& blockSpells = m_caster->GetAuraEffectsByType(SPELL_AURA_BLOCK_SPELL_FAMILY); for (Unit::AuraEffectList::const_iterator blockItr = blockSpells.begin(); blockItr != blockSpells.end(); ++blockItr) - if ((*blockItr)->GetMiscValue() == m_spellInfo->SpellFamilyName) + if (uint32((*blockItr)->GetMiscValue()) == m_spellInfo->SpellFamilyName) return SPELL_FAILED_SPELL_UNAVAILABLE; bool reqCombat = true; diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 73e6b0ac8a5..3de1181f764 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1042,7 +1042,7 @@ public: return true; } - static bool HandleDebugLoSCommand(ChatHandler* handler, char const* args) + static bool HandleDebugLoSCommand(ChatHandler* handler, char const* /*args*/) { if (Unit* unit = handler->getSelectedUnit()) handler->PSendSysMessage("Unit %s (GuidLow: %u) is %sin LoS", unit->GetName(), unit->GetGUIDLow(), handler->GetSession()->GetPlayer()->IsWithinLOSInMap(unit) ? "" : "not "); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index a78a29704cc..242b2f2f0ea 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -308,7 +308,7 @@ struct boss_twin_baseAI : public ScriptedAI void EnableDualWield(bool mode = true) { - SetEquipmentSlots(false, m_uiWeapon, mode ? m_uiWeapon : EQUIP_UNEQUIP, EQUIP_UNEQUIP); + SetEquipmentSlots(false, m_uiWeapon, mode ? m_uiWeapon : int32(EQUIP_UNEQUIP), EQUIP_UNEQUIP); me->SetCanDualWield(mode); me->UpdateDamagePhysical(mode ? OFF_ATTACK : BASE_ATTACK); } diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp index 97ce9f45430..c9fdd0f65ff 100644 --- a/src/server/scripts/Outland/blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/blades_edge_mountains.cpp @@ -739,7 +739,7 @@ class npc_simon_bunny : public CreatureScript if (!listening) return; - uint8 pressedColor; + uint8 pressedColor = SIMON_MAX_COLORS; if (type == clusterIds[SIMON_RED]) pressedColor = SIMON_RED; @@ -974,7 +974,7 @@ class npc_simon_bunny : public CreatureScript // Handles the spell rewards. The spells also have the QuestCompleteEffect, so quests credits are working. void GiveRewardForLevel(uint8 level) { - uint32 rewSpell; + uint32 rewSpell = 0; switch (level) { case 6: @@ -989,8 +989,6 @@ class npc_simon_bunny : public CreatureScript case 10: rewSpell = SPELL_REWARD_BUFF_3; break; - default: - rewSpell = 0; } if (rewSpell) diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 9899e50cd28..09fb6830da8 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1521,7 +1521,7 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader if (group && group->isLFGGroup()) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) - if (dungeon->map == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM) return; // in correct dungeon @@ -1706,6 +1706,8 @@ class spell_gen_break_shield: public SpellScriptLoader } break; } + default: + break; } } @@ -1834,7 +1836,7 @@ class spell_gen_mounted_charge: public SpellScriptLoader } } - void HandleChargeEffect(SpellEffIndex effIndex) + void HandleChargeEffect(SpellEffIndex /*effIndex*/) { uint32 spellId; @@ -1908,7 +1910,7 @@ class spell_gen_defend : public SpellScriptLoader void RefreshVisualShields(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - if (Unit* caster = GetCaster()) + if (GetCaster()) { Unit* target = GetTarget(); @@ -1989,7 +1991,7 @@ class spell_gen_tournament_duel : public SpellScriptLoader return true; } - void HandleScriptEffect(SpellEffIndex effIndex) + void HandleScriptEffect(SpellEffIndex /*effIndex*/) { if (Unit* rider = GetCaster()->GetCharmer()) { -- cgit v1.2.3 From 41d99a474ca1c210e0f6730dc8808700ba2705a2 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 16 Feb 2012 21:47:33 +0100 Subject: Scripts/Icecrown Citadel: Remove obsolete code since spline movement implementation --- .../scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index b2ee0572247..fbed870eb19 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -501,13 +501,6 @@ class boss_the_lich_king : public CreatureScript DoCastAOE(SPELL_PLAY_MOVIE, false); me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, 0x03); - float x, y, z; - me->GetPosition(x, y, z); - // use larger distance for vmap height search than in most other cases - float ground_Z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z, true, MAX_FALL_DISTANCE); - if (fabs(ground_Z - z) < 0.1f) - return; - me->GetMotionMaster()->MoveFall(); } -- cgit v1.2.3 From c517806a23751dd92d6a064b7f721507f182bc75 Mon Sep 17 00:00:00 2001 From: Kandera Date: Sat, 18 Feb 2012 12:12:49 +0100 Subject: Scripts/Spells: Convert code from Spell::EffectDummy to spell scripts. --- .../2012_02_16_00_world_spell_script_names.sql | 69 + .../world/2012_02_16_01_world_spell_dbc.sql | 3 + src/server/game/Entities/Unit/Unit.cpp | 1 + src/server/game/Grids/Notifiers/GridNotifiers.h | 14 +- src/server/game/Spells/SpellEffects.cpp | 738 +------ src/server/game/Spells/SpellScript.cpp | 10 + src/server/game/Spells/SpellScript.h | 5 +- .../scripts/Northrend/Naxxramas/boss_thaddius.cpp | 41 +- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 63 + .../Outland/TempestKeep/Eye/boss_astromancer.cpp | 67 +- .../Mechanar/boss_mechano_lord_capacitus.cpp | 55 +- src/server/scripts/Spells/spell_dk.cpp | 182 +- src/server/scripts/Spells/spell_druid.cpp | 61 +- src/server/scripts/Spells/spell_generic.cpp | 671 ++++--- src/server/scripts/Spells/spell_hunter.cpp | 713 ++++--- src/server/scripts/Spells/spell_item.cpp | 2100 ++++++++++++++------ src/server/scripts/Spells/spell_mage.cpp | 140 +- src/server/scripts/Spells/spell_paladin.cpp | 500 ++--- src/server/scripts/Spells/spell_priest.cpp | 50 +- src/server/scripts/Spells/spell_quest.cpp | 1052 +++++----- src/server/scripts/Spells/spell_rogue.cpp | 282 ++- src/server/scripts/Spells/spell_shaman.cpp | 304 ++- src/server/scripts/Spells/spell_warlock.cpp | 164 +- src/server/scripts/Spells/spell_warrior.cpp | 302 ++- 24 files changed, 4534 insertions(+), 3053 deletions(-) create mode 100644 sql/updates/world/2012_02_16_00_world_spell_script_names.sql create mode 100644 sql/updates/world/2012_02_16_01_world_spell_dbc.sql (limited to 'src/server/scripts/Northrend') diff --git a/sql/updates/world/2012_02_16_00_world_spell_script_names.sql b/sql/updates/world/2012_02_16_00_world_spell_script_names.sql new file mode 100644 index 00000000000..993fe3a2f38 --- /dev/null +++ b/sql/updates/world/2012_02_16_00_world_spell_script_names.sql @@ -0,0 +1,69 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` in (-100,-12162,13567,17251,23019,23448,23453,25860,28089,29200,29858,30458,30507,31225,35745,37674,39090,39093,39096,42784,43723,44875,47170,49357,50243,51582,51961,52759,52845,53808,54171,54577,55004,64385,-1464,-5308,12809,23881,-1454,-50286,8171,52041,52046,52047,52048,52049,52050,52059,52060,52061,52031,52033,52034,52035,52036,58778,58779,58780,60103,-49998,-66188,-47541,52375,59134,-62900,49560,62324,31890); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(-100,'spell_warr_charge'), +(-12162,'spell_warr_deep_wounds'), +(13567,'spell_gen_dummy_trigger'), +(17251,'spell_gen_spirit_healer_res'), +(23019,'spell_item_crystal_prison_dummy_dnd'), +(23448,'spell_gen_gadgetzan_transporter_backfire'), +(23453,'spell_gen_gnomish_transporter'), +(25860,'spell_item_reindeer_transformation'), +(28089,'spell_thaddius_polarity_shift'), +(29200,'spell_item_purify_helboar_meat'), +(29858,'spell_warl_soulshatter'), +(30458,'spell_item_nigh_invulnerability'), +(30507,'spell_item_poultryizer'), +(31225,'spell_item_shimmering_vessel'), +(35745,'spell_item_socrethars_stone'), +(37674,'spell_gen_chaos_blast'), +(39090,'spell_capacitus_polarity_charge'), +(39093,'spell_capacitus_polarity_charge'), +(39096,'spell_capacitus_polarity_shift'), +(42784,'spell_astromancer_wrath_of_the_astromancer'), +(43723,'spell_item_demon_broiled_surprise'), +(44875,'spell_item_complete_raptor_capture'), +(47170,'spell_item_impale_leviroth'), +(49357,'spell_item_brewfest_mount_transformation'), +(50243,'spell_item_teach_language'), +(51582,'spell_item_rocket_boots'), +(51961,'spell_item_chicken_cover'), +(52759,'spell_sha_ancestral_awakening_proc'), +(52845,'spell_item_brewfest_mount_transformation'), +(53808,'spell_item_pygmy_oil'), +(54577,'spell_item_uded'), +(54171,'spell_pal_divine_storm_dummy'), +(55004,'spell_item_nitro_boots'), +(64385,'spell_item_unusual_compass'), +(-1464,'spell_warr_slam'), +(-5308,'spell_warr_execute'), +(12809,'spell_warr_concussion_blow'), +(23881,'spell_warr_bloodthirst'), +(-1454,'spell_warl_life_tap'), +(-50286,'spell_dru_starfall_dummy'), +(8171,'spell_sha_cleansing_totem_pulse'), +(52041,'spell_sha_healing_stream_totem'), +(52046,'spell_sha_healing_stream_totem'), +(52047,'spell_sha_healing_stream_totem'), +(52048,'spell_sha_healing_stream_totem'), +(52049,'spell_sha_healing_stream_totem'), +(52050,'spell_sha_healing_stream_totem'), +(52059,'spell_sha_healing_stream_totem'), +(52060,'spell_sha_healing_stream_totem'), +(52061,'spell_sha_healing_stream_totem'), +(52031,'spell_sha_mana_spring_totem'), +(52033,'spell_sha_mana_spring_totem'), +(52034,'spell_sha_mana_spring_totem'), +(52035,'spell_sha_mana_spring_totem'), +(52036,'spell_sha_mana_spring_totem'), +(58778,'spell_sha_mana_spring_totem'), +(58779,'spell_sha_mana_spring_totem'), +(58780,'spell_sha_mana_spring_totem'), +(60103,'spell_sha_lava_lash'), +(-49998,'spell_dk_death_strike'), +(-66188,'spell_dk_death_strike'), +(-47541,'spell_dk_death_coil'), +(52375,'spell_dk_death_coil'), +(59134,'spell_dk_death_coil'), +(-62900,'spell_dk_death_coil'), +(49560,'spell_dk_death_grip'), +(62324,'spell_vehicle_throw_passenger'); diff --git a/sql/updates/world/2012_02_16_01_world_spell_dbc.sql b/sql/updates/world/2012_02_16_01_world_spell_dbc.sql new file mode 100644 index 00000000000..b343399d7f2 --- /dev/null +++ b/sql/updates/world/2012_02_16_01_world_spell_dbc.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_dbc` WHERE `id`=31980; +INSERT INTO `spell_dbc` (`Id`,`Dispel`,`Mechanic`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`AttributesEx6`,`AttributesEx7`,`Stances`,`StancesNot`,`Targets`,`CastingTimeIndex`,`AuraInterruptFlags`,`ProcFlags`,`ProcChance`,`ProcCharges`,`MaxLevel`,`BaseLevel`,`SpellLevel`,`DurationIndex`,`RangeIndex`,`StackAmount`,`EquippedItemClass`,`EquippedItemSubClassMask`,`EquippedItemInventoryTypeMask`,`Effect1`,`Effect2`,`Effect3`,`EffectDieSides1`,`EffectDieSides2`,`EffectDieSides3`,`EffectRealPointsPerLevel1`,`EffectRealPointsPerLevel2`,`EffectRealPointsPerLevel3`,`EffectBasePoints1`,`EffectBasePoints2`,`EffectBasePoints3`,`EffectMechanic1`,`EffectMechanic2`,`EffectMechanic3`,`EffectImplicitTargetA1`,`EffectImplicitTargetA2`,`EffectImplicitTargetA3`,`EffectImplicitTargetB1`,`EffectImplicitTargetB2`,`EffectImplicitTargetB3`,`EffectRadiusIndex1`,`EffectRadiusIndex2`,`EffectRadiusIndex3`,`EffectApplyAuraName1`,`EffectApplyAuraName2`,`EffectApplyAuraName3`,`EffectAmplitude1`,`EffectAmplitude2`,`EffectAmplitude3`,`EffectMultipleValue1`,`EffectMultipleValue2`,`EffectMultipleValue3`,`EffectMiscValue1`,`EffectMiscValue2`,`EffectMiscValue3`,`EffectMiscValueB1`,`EffectMiscValueB2`,`EffectMiscValueB3`,`EffectTriggerSpell1`,`EffectTriggerSpell2`,`EffectTriggerSpell3`,`EffectSpellClassMaskA1`,`EffectSpellClassMaskA2`,`EffectSpellClassMaskA3`,`EffectSpellClassMaskB1`,`EffectSpellClassMaskB2`,`EffectSpellClassMaskB3`,`EffectSpellClassMaskC1`,`EffectSpellClassMaskC2`,`EffectSpellClassMaskC3`,`MaxTargetLevel`,`SpellFamilyName`,`SpellFamilyFlags1`,`SpellFamilyFlags2`,`SpellFamilyFlags3`,`MaxAffectedTargets`,`DmgClass`,`PreventionType`,`DmgMultiplier1`,`DmgMultiplier2`,`DmgMultiplier3`,`AreaGroupId`,`SchoolMask`,`Comment`) VALUES +(31980,0,0,328064,1024,4,268894208,0,0,0,0,0,0,0,1,0,0,101,0,0,14,14,0,13,0,-1,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,22,0,0,15,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,4,0,0,0,0,1,0,0,0,1,"Righteous Defense Trigger Spell"); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 7bcd993192e..4670a976e42 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9768,6 +9768,7 @@ void Unit::SetMinion(Minion *minion, bool apply) { // Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL)); + if (spellInfo && (spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)) ToPlayer()->AddSpellAndCategoryCooldowns(spellInfo, 0, NULL, true); } diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 4112711ad3c..12e3fda0484 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -530,26 +530,24 @@ namespace Trinity class RaiseDeadObjectCheck { public: - RaiseDeadObjectCheck(Unit* source, float range) : _source(source), i_range(range) {} + RaiseDeadObjectCheck(Unit* source, float range) : _source(source), _range(range) {} bool operator()(Creature* u) { if (_source->GetTypeId() != TYPEID_PLAYER || !((Player*)_source)->isHonorOrXPTarget(u) || - u->getDeathState() != CORPSE || + u->getDeathState() != CORPSE || (u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0 || (u->GetDisplayId() != u->GetNativeDisplayId())) return false; - return _source->IsWithinDistInMap(u, i_range); + return _source->IsWithinDistInMap(u, _range); } - bool operator()(Player* u) { if (_source == u || _source->GetTypeId() != TYPEID_PLAYER || !((Player*)_source)->isHonorOrXPTarget(u) || u->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST) || u->isInFlight() || !u->isDead() || (u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0) return false; - - return _source->IsWithinDistInMap(u, i_range); + return _source->IsWithinDistInMap(u, _range); } bool operator()(Corpse* u) @@ -557,12 +555,12 @@ namespace Trinity if (_source->GetTypeId() != TYPEID_PLAYER || u->GetType() == CORPSE_BONES) return false; - return _source->IsWithinDistInMap(u, i_range); + return _source->IsWithinDistInMap(u, _range); } template bool operator()(NOT_INTERESTED*) { return false; } private: Unit* const _source; - float i_range; + float _range; }; class ExplodeCorpseObjectCheck diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 837133c141f..407ddbf6b21 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -751,600 +751,6 @@ void Spell::EffectDummy(SpellEffIndex effIndex) // selection by spell family switch (m_spellInfo->SpellFamilyName) { - case SPELLFAMILY_GENERIC: - { - switch (m_spellInfo->Id) - { - case 31225: // Shimmering Vessel (restore creature to life) - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) - return; - unitTarget->ToCreature()->setDeathState(JUST_ALIVED); - return; - } - case 12162: // Deep wounds - case 12850: // (now good common check for this spells) - case 12868: - { - if (!unitTarget) - return; - - // apply percent damage mods - damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, damage, SPELL_DIRECT_DAMAGE); - - switch (m_spellInfo->Id) - { - case 12162: ApplyPctN(damage, 16); break; // Rank 1 - case 12850: ApplyPctN(damage, 32); break; // Rank 2 - case 12868: ApplyPctN(damage, 48); break; // Rank 3 - default: - sLog->outError("Spell::EffectDummy: Spell %u not handled in DW", m_spellInfo->Id); - return; - } - - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(12721); - uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude; - - // Add remaining ticks to damage done - if (AuraEffect const* aurEff = unitTarget->GetAuraEffect(12721, EFFECT_0, m_caster->GetGUID())) - damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber()); - - damage = damage / ticks; - m_caster->CastCustomSpell(unitTarget, 12721, &damage, NULL, NULL, true); - return; - } - case 13567: // Dummy Trigger - { - // can be used for different aura triggering, so select by aura - if (!m_triggeredByAuraSpell || !unitTarget) - return; - - switch (m_triggeredByAuraSpell->Id) - { - case 26467: // Persistent Shield - m_caster->CastCustomSpell(unitTarget, 26470, &damage, NULL, NULL, true); - break; - default: - sLog->outError("EffectDummy: Non-handled case for spell 13567 for triggered aura %u", m_triggeredByAuraSpell->Id); - break; - } - return; - } - case 17251: // Spirit Healer Res - { - if (!unitTarget || !m_originalCaster) - return; - - if (m_originalCaster->GetTypeId() == TYPEID_PLAYER) - { - WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8); - data << uint64(unitTarget->GetGUID()); - m_originalCaster->ToPlayer()->GetSession()->SendPacket(&data); - } - return; - } - case 23019: // Crystal Prison Dummy DND - { - if (!unitTarget || !unitTarget->isAlive() || unitTarget->GetTypeId() != TYPEID_UNIT || unitTarget->ToCreature()->isPet()) - return; - - Creature* creatureTarget = unitTarget->ToCreature(); - - m_caster->SummonGameObject(179644, creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(), creatureTarget->GetOrientation(), 0, 0, 0, 0, uint32(creatureTarget->GetRespawnTime()-time(NULL))); - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SummonGameObject at SpellEfects.cpp EffectDummy for Spell 23019"); - - creatureTarget->DespawnOrUnsummon(); - - return; - } - case 23448: // Transporter Arrival - Ultrasafe Transporter: Gadgetzan - backfires - { - int32 r = irand(0, 119); - if (r < 20) // Transporter Malfunction - 1/6 polymorph - m_caster->CastSpell(m_caster, 23444, true); - else if (r < 100) // Evil Twin - 4/6 evil twin - m_caster->CastSpell(m_caster, 23445, true); - else // Transporter Malfunction - 1/6 miss the target - m_caster->CastSpell(m_caster, 36902, true); - return; - } - case 23453: // Gnomish Transporter - Ultrasafe Transporter: Gadgetzan - if (roll_chance_i(50)) // Gadgetzan Transporter - success - m_caster->CastSpell(m_caster, 23441, true); - else // Gadgetzan Transporter Failure - failure - m_caster->CastSpell(m_caster, 23446, true); - return; - case 25860: // Reindeer Transformation - { - if (!m_caster->HasAuraType(SPELL_AURA_MOUNTED)) - return; - - float flyspeed = m_caster->GetSpeedRate(MOVE_FLIGHT); - float speed = m_caster->GetSpeedRate(MOVE_RUN); - - 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) - // Flying Reindeer - m_caster->CastSpell(m_caster, 44827, true); //310% flying Reindeer - else if (flyspeed >= 3.8f) - // Flying Reindeer - m_caster->CastSpell(m_caster, 44825, true); //280% flying Reindeer - else if (flyspeed >= 1.6f) - // Flying Reindeer - m_caster->CastSpell(m_caster, 44824, true); //60% flying Reindeer - else if (speed >= 2.0f) - // Reindeer - m_caster->CastSpell(m_caster, 25859, true); //100% ground Reindeer - else - // Reindeer - m_caster->CastSpell(m_caster, 25858, true); //60% ground Reindeer - - return; - } - case 26074: // Holiday Cheer - // implemented at client side - return; - // Polarity Shift - case 28089: - if (unitTarget) - unitTarget->CastSpell(unitTarget, roll_chance_i(50) ? 28059 : 28084, true, NULL, NULL, m_caster->GetGUID()); - break; - // Polarity Shift - case 39096: - if (unitTarget) - unitTarget->CastSpell(unitTarget, roll_chance_i(50) ? 39088 : 39091, true, NULL, NULL, m_caster->GetGUID()); - break; - case 29200: // Purify Helboar Meat - { - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return; - - spell_id = roll_chance_i(50) - ? 29277 // Summon Purified Helboar Meat - : 29278; // Summon Toxic Helboar Meat - - m_caster->CastSpell(m_caster, spell_id, true, NULL); - return; - } - case 29858: // Soulshatter - if (unitTarget && unitTarget->CanHaveThreatList() - && unitTarget->getThreatManager().getThreat(m_caster) > 0.0f) - m_caster->CastSpell(unitTarget, 32835, true); - return; - case 30458: // Nigh Invulnerability - if (!m_CastItem) return; - if (roll_chance_i(86)) // Nigh-Invulnerability - success - m_caster->CastSpell(m_caster, 30456, true, m_CastItem); - else // Complete Vulnerability - backfire in 14% casts - m_caster->CastSpell(m_caster, 30457, true, m_CastItem); - return; - case 30507: // Poultryizer - if (!m_CastItem) return; - if (roll_chance_i(80)) // Poultryized! - success - m_caster->CastSpell(unitTarget, 30501, true, m_CastItem); - else // Poultryized! - backfire 20% - m_caster->CastSpell(unitTarget, 30504, true, m_CastItem); - return; - case 35745: // Socrethar's Stone - { - switch (m_caster->GetAreaId()) - { - case 3900: - spell_id = 35743; - break; // Socrethar Portal - case 3742: - spell_id = 35744; - break; // Socrethar Portal - default: - return; - } - - m_caster->CastSpell(m_caster, spell_id, true); - return; - } - case 37674: // Chaos Blast - { - if (!unitTarget) - return; - - int32 basepoints0 = 100; - m_caster->CastCustomSpell(unitTarget, 37675, &basepoints0, NULL, NULL, true); - return; - } - // Wrath of the Astromancer - case 42784: - { - uint32 count = 0; - for (std::list::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) - if (ihit->effectMask & (1<GetSpellInfo(42784); - - // now deal the damage - for (std::list::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) - if (ihit->effectMask & (1<targetGUID)) - m_caster->DealDamage(casttarget, damage, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, spellInfo, false); - } - - return; - } - // Demon Broiled Surprise - case 43723: - { - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return; - - Player* player = (Player*)m_caster; - - if (player && player->GetQuestStatus(11379) == QUEST_STATUS_INCOMPLETE) - { - Creature* creature = player->FindNearestCreature(19973, 10, false); - if (!creature) - { - SendCastResult(SPELL_FAILED_NOT_HERE); - return; - } - - player->CastSpell(player, 43753, false); - } - return; - } - case 44875: // Complete Raptor Capture - { - if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) - return; - - unitTarget->ToCreature()->DespawnOrUnsummon(); - - //cast spell Raptor Capture Credit - m_caster->CastSpell(m_caster, 42337, true, NULL); - return; - } - case 47170: // Impale Leviroth - { - if (!unitTarget || (unitTarget->GetEntry() != 26452 && unitTarget->HealthAbovePct(95))) - return; - - m_caster->DealDamage(unitTarget, unitTarget->CountPctFromMaxHealth(93)); - return; - } - case 49357: // Brewfest Mount Transformation - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return; - if (!m_caster->HasAuraType(SPELL_AURA_MOUNTED)) - return; - m_caster->RemoveAurasByType(SPELL_AURA_MOUNTED); - // Ram for Alliance, Kodo for Horde - if (m_caster->ToPlayer()->GetTeam() == ALLIANCE) - { - if (m_caster->GetSpeedRate(MOVE_RUN) >= 2.0f) - // 100% Ram - m_caster->CastSpell(m_caster, 43900, true); - else - // 60% Ram - m_caster->CastSpell(m_caster, 43899, true); - } - else - { - if (m_caster->ToPlayer()->GetSpeedRate(MOVE_RUN) >= 2.0f) - // 100% Kodo - m_caster->CastSpell(m_caster, 49379, true); - else - // 60% Kodo - m_caster->CastSpell(m_caster, 49378, true); - } - return; - case 52845: // Brewfest Mount Transformation (Faction Swap) - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return; - if (!m_caster->HasAuraType(SPELL_AURA_MOUNTED)) - return; - m_caster->RemoveAurasByType(SPELL_AURA_MOUNTED); - // Ram for Horde, Kodo for Alliance - if (m_caster->ToPlayer()->GetTeam() == HORDE) - { - if (m_caster->GetSpeedRate(MOVE_RUN) >= 2.0f) - // 100% Ram - m_caster->CastSpell(m_caster, 43900, true); - else - // 60% Ram - m_caster->CastSpell(m_caster, 43899, true); - } - else - { - if (m_caster->ToPlayer()->GetSpeedRate(MOVE_RUN) >= 2.0f) - // 100% Kodo - m_caster->CastSpell(m_caster, 49379, true); - else - // 60% Kodo - m_caster->CastSpell(m_caster, 49378, true); - } - return; - case 55004: // Nitro Boosts - if (!m_CastItem) - return; - if (roll_chance_i(95)) // Nitro Boosts - success - m_caster->CastSpell(m_caster, 54861, true, m_CastItem); - else // Knocked Up - backfire 5% - m_caster->CastSpell(m_caster, 46014, true, m_CastItem); - return; - case 50243: // Teach Language - { - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return; - - // spell has a 1/3 chance to trigger one of the below - if (roll_chance_i(66)) - return; - if (m_caster->ToPlayer()->GetTeam() == ALLIANCE) - { - // 1000001 - gnomish binary - m_caster->CastSpell(m_caster, 50242, true); - } - else - { - // 01001000 - goblin binary - m_caster->CastSpell(m_caster, 50246, true); - } - - return; - } - case 51582: //Rocket Boots Engaged (Rocket Boots Xtreme and Rocket Boots Xtreme Lite) - { - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return; - - if (Battleground* bg = m_caster->ToPlayer()->GetBattleground()) - bg->EventPlayerDroppedFlag(m_caster->ToPlayer()); - - m_caster->CastSpell(m_caster, 30452, true, NULL); - return; - } - case 52759: // Ancestral Awakening - if (!unitTarget) - return; - m_caster->CastCustomSpell(unitTarget, 52752, &damage, NULL, NULL, true); - return; - case 54171: // Divine Storm - { - if (m_UniqueTargetInfo.size()) - { - int32 heal = damage / m_UniqueTargetInfo.size(); - m_caster->CastCustomSpell(unitTarget, 54172, &heal, NULL, NULL, true); - } - return; - } - case 58418: // Portal to Orgrimmar - case 58420: // Portal to Stormwind - return; // implemented in EffectScript[0] - case 62324: // Throw Passenger - { - if (m_targets.HasTraj()) - { - if (Vehicle* vehicle = m_caster->GetVehicleKit()) - if (Unit* passenger = vehicle->GetPassenger(damage - 1)) - { - std::list unitList; - // use 99 because it is 3d search - SearchAreaTarget(unitList, 99, PUSH_DST_CENTER, SPELL_TARGETS_ENTRY, 33114); - float minDist = 99 * 99; - Unit* target = NULL; - for (std::list::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - { - if (Vehicle* seat = (*itr)->GetVehicleKit()) - if (!seat->GetPassenger(0)) - if (Unit* device = seat->GetPassenger(2)) - if (!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - { - float dist = (*itr)->GetExactDistSq(m_targets.GetDst()); - if (dist < minDist) - { - minDist = dist; - target = (*itr); - } - } - } - if (target && target->IsWithinDist2d(m_targets.GetDst(), m_spellInfo->Effects[effIndex].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct - passenger->EnterVehicle(target, 0); - else - { - passenger->ExitVehicle(); - float x, y, z; - m_targets.GetDst()->GetPosition(x, y, z); - passenger->GetMotionMaster()->MoveJump(x, y, z, m_targets.GetSpeedXY(), m_targets.GetSpeedZ()); - } - } - } - return; - } - case 64385: // Unusual Compass - { - m_caster->SetOrientation(float(urand(0, 62832)) / 10000.0f); - WorldPacket data; - m_caster->BuildHeartBeatMsg(&data); - m_caster->SendMessageToSet(&data, true); - return; - } - case 53808: // Pygmy Oil - { - Aura* pAura = m_caster->GetAura(53806); - if (pAura) - pAura->RefreshDuration(); - else - { - pAura = m_caster->GetAura(53805); - if (!pAura || pAura->GetStackAmount() < 5 || !roll_chance_i(50)) - m_caster->CastSpell(m_caster, 53805, true); - else - { - pAura->Remove(); - m_caster->CastSpell(m_caster, 53806, true); - } - } - return; - } - case 54577: // U.D.E.D. - { - if (unitTarget->GetEntry() != 29402) - return; - - m_caster->SummonGameObject(192693, unitTarget->GetPositionX(), unitTarget->GetPositionY(), - unitTarget->GetPositionZ(), unitTarget->GetOrientation(), 0, 0, 0, 0, 100); - - for (uint8 i = 0; i < 4; ++i) - m_caster->SummonGameObject(191567, float(unitTarget->GetPositionX() + irand(-7, 7)), - float(unitTarget->GetPositionY() + irand(-7, 7)), unitTarget->GetPositionZ(), unitTarget->GetOrientation(), - 0, 0, 0, 0, 100); - - unitTarget->Kill(unitTarget); - return; - } - case 51961: // Captured Chicken Cover - Quest 12702 & 12532 - { - if (m_caster->GetTypeId() != TYPEID_PLAYER - || !unitTarget->HasAura(51959) - || !(m_caster->ToPlayer()->GetQuestStatus(12702) == QUEST_STATUS_INCOMPLETE || m_caster->ToPlayer()->GetQuestStatus(12532) == QUEST_STATUS_INCOMPLETE)) - return; - - m_caster->CastSpell(m_caster, 51037, true); - unitTarget->Kill(unitTarget); - return; - } - } - - break; - } - case SPELLFAMILY_WARRIOR: - // Charge - if (m_spellInfo->SpellFamilyFlags & SPELLFAMILYFLAG_WARRIOR_CHARGE && m_spellInfo->SpellVisual[0] == 867) - { - int32 chargeBasePoints0 = damage; - m_caster->CastCustomSpell(m_caster, 34846, &chargeBasePoints0, NULL, NULL, true); - - //Juggernaut crit bonus - if (m_caster->HasAura(64976)) - m_caster->CastSpell(m_caster, 65156, true); - return; - } - // Slam - if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARRIOR_SLAM && m_spellInfo->SpellIconID == 559) - { - int32 bp0 = damage; - m_caster->CastCustomSpell(unitTarget, 50783, &bp0, NULL, NULL, true, 0); - return; - } - // Execute - if (m_spellInfo->SpellFamilyFlags[EFFECT_0] & SPELLFAMILYFLAG_WARRIOR_EXECUTE) - { - if (!unitTarget) - return; - - spell_id = 20647; - - int32 rageUsed = std::min(300 - m_powerCost, m_caster->GetPower(POWER_RAGE)); - int32 newRage = std::max(0, m_caster->GetPower(POWER_RAGE) - rageUsed); - - // Sudden Death rage save - if (AuraEffect* aurEff = m_caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_GENERIC, 1989, EFFECT_0)) - { - int32 ragesave = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 10; - newRage = std::max(newRage, ragesave); - } - - m_caster->SetPower(POWER_RAGE, uint32(newRage)); - - // Glyph of Execution bonus - if (AuraEffect* aurEff = m_caster->GetAuraEffect(58367, EFFECT_0)) - rageUsed += aurEff->GetAmount() * 10; - - bp = damage + int32(rageUsed * m_spellInfo->Effects[effIndex].DamageMultiplier + m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f); - break; - } - // Concussion Blow - if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARRIOR_CONCUSSION_BLOW) - { - m_damage += CalculatePctF(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK)); - return; - } - switch (m_spellInfo->Id) - { - // Bloodthirst - case 23881: - { - m_caster->CastCustomSpell(unitTarget, 23885, &damage, NULL, NULL, true, NULL); - return; - } - } - break; - case SPELLFAMILY_WARLOCK: - // Life Tap - if ((m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_WARLOCK_LIFETAP) && m_caster->ToPlayer()) - { - float spFactor = 0.0f; - switch (m_spellInfo->Id) - { - case 11689: spFactor = 0.2f; break; - case 27222: - case 57946: spFactor = 0.5f; break; - } - int32 damage = int32(m_spellInfo->Effects[EFFECT_0].CalcValue() + (6.3875 * m_spellInfo->BaseLevel)); - int32 mana = int32(damage + (m_caster->ToPlayer()->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+SPELL_SCHOOL_SHADOW) * spFactor)); - - if (unitTarget && (int32(unitTarget->GetHealth()) > damage)) - { - // Shouldn't Appear in Combat Log - unitTarget->ModifyHealth(-damage); - - // Improved Life Tap mod - if (AuraEffect const* aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 208, 0)) - AddPctN(mana, aurEff->GetAmount()); - - m_caster->CastCustomSpell(unitTarget, 31818, &mana, NULL, NULL, false); - - // Mana Feed - int32 manaFeedVal = 0; - if (AuraEffect const* aurEff = m_caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARLOCK, 1982, 0)) - manaFeedVal = aurEff->GetAmount(); - - if (manaFeedVal > 0) - { - ApplyPctN(manaFeedVal, mana); - m_caster->CastCustomSpell(m_caster, 32553, &manaFeedVal, NULL, NULL, true, NULL); - } - } - else - SendCastResult(SPELL_FAILED_FIZZLE); - return; - } - break; - case SPELLFAMILY_DRUID: - // Starfall - if (m_spellInfo->SpellFamilyFlags[2] & SPELLFAMILYFLAG2_DRUID_STARFALL) - { - //Shapeshifting into an animal form or mounting cancels the effect. - if (m_caster->GetCreatureType() == CREATURE_TYPE_BEAST || m_caster->IsMounted()) - { - if (m_triggeredByAuraSpell) - m_caster->RemoveAurasDueToSpell(m_triggeredByAuraSpell->Id); - return; - } - - //Any effect which causes you to lose control of your character will supress the starfall effect. - if (m_caster->HasUnitState(UNIT_STATE_CONTROLLED)) - return; - - m_caster->CastSpell(unitTarget, damage, true); - return; - } - break; case SPELLFAMILY_PALADIN: switch (m_spellInfo->Id) { @@ -1378,128 +784,40 @@ void Spell::EffectDummy(SpellEffIndex effIndex) } } break; - case SPELLFAMILY_SHAMAN: - // Cleansing Totem Pulse - if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_TOTEM_EFFECTS && m_spellInfo->SpellIconID == 1673) - { - int32 bp1 = 1; - // Cleansing Totem Effect - if (unitTarget) - m_caster->CastCustomSpell(unitTarget, 52025, NULL, &bp1, NULL, true, NULL, NULL, m_originalCasterGUID); - return; - } - // Healing Stream Totem - if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_HEALING_STREAM) - { - if (!unitTarget) - return; - if (Unit* owner = m_caster->GetOwner()) - { - if (m_triggeredByAuraSpell) - damage = int32(owner->SpellHealingBonus(unitTarget, m_triggeredByAuraSpell, damage, HEAL)); - - // Restorative Totems - if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 338, 1)) - AddPctN(damage, dummy->GetAmount()); - - // Glyph of Healing Stream Totem - if (AuraEffect const* aurEff = owner->GetAuraEffect(55456, EFFECT_0)) - AddPctN(damage, aurEff->GetAmount()); - } - m_caster->CastCustomSpell(unitTarget, 52042, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); - return; - } - // Mana Spring Totem - if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_MANA_SPRING) - { - if (!unitTarget || unitTarget->getPowerType() != POWER_MANA) - return; - m_caster->CastCustomSpell(unitTarget, 52032, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); - return; - } - // Lava Lash - if (m_spellInfo->SpellFamilyFlags[2] & SPELLFAMILYFLAG2_SHAMAN_LAVA_LASH) - { - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return; - - if (m_caster->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND)) - { - // Damage is increased by 25% if your off-hand weapon is enchanted with Flametongue. - if (m_caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000, 0, 0)) - AddPctN(m_damage, damage); - } - return; - } - break; case SPELLFAMILY_DEATHKNIGHT: - // Death strike - if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_DK_DEATH_STRIKE) - { - uint32 count = unitTarget->GetDiseasesByCaster(m_caster->GetGUID()); - bp = int32(count * m_caster->CountPctFromMaxHealth(int32(m_spellInfo->Effects[EFFECT_0].DamageMultiplier))); - // Improved Death Strike - if (AuraEffect const* aurEff = m_caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, 2751, 0)) - AddPctN(bp, m_caster->CalculateSpellDamage(m_caster, aurEff->GetSpellInfo(), 2)); - m_caster->CastCustomSpell(m_caster, 45470, &bp, NULL, NULL, false); - return; - } - // Death Coil - if (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_DK_DEATH_COIL) - { - if (m_caster->IsFriendlyTo(unitTarget)) - { - bp = int32(damage * 1.5f); - m_caster->CastCustomSpell(unitTarget, 47633, &bp, NULL, NULL, true); - } - else - { - bp = damage; - m_caster->CastCustomSpell(unitTarget, 47632, &bp, NULL, NULL, true); - } - return; - } switch (m_spellInfo->Id) { - case 49560: // Death Grip - Position pos; - GetSummonPosition(effIndex, pos); - if (Unit* unit = unitTarget->GetVehicleBase()) // what is this for? - unit->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true); - else if (!unitTarget->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence - unitTarget->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true); - return; - case 46584: // Raise Dead - if (m_caster->GetTypeId() != TYPEID_PLAYER) - return; + case 46584: // Raise Dead + if (m_caster->GetTypeId() != TYPEID_PLAYER) + return; - // Do we have talent Master of Ghouls? - if (m_caster->HasAura(52143)) - // summon as pet - bp = 52150; - else - // or guardian - bp = 46585; + // Do we have talent Master of Ghouls? + if (m_caster->HasAura(52143)) + // summon as pet + bp = 52150; + else + // or guardian + bp = 46585; - if (m_targets.HasDst()) - targets.SetDst(*m_targets.GetDst()); - else - { - targets.SetDst(*m_caster); - // Corpse not found - take reagents (only not triggered cast can take them) - triggered = false; - } - // Remove cooldown - summon spellls have category - m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true); - spell_id = 48289; - break; - // Raise dead - take reagents and trigger summon spells - case 48289: - if (m_targets.HasDst()) - targets.SetDst(*m_targets.GetDst()); + if (m_targets.HasDst()) + targets.SetDst(*m_targets.GetDst()); + else + { + targets.SetDst(*m_caster); + // Corpse not found - take reagents (only not triggered cast can take them) + triggered = false; + } + // Remove cooldown - summon spellls have category + m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true); + spell_id = 48289; + break; + // Raise dead - take reagents and trigger summon spells + case 48289: + if (m_targets.HasDst()) + targets.SetDst(*m_targets.GetDst()); - spell_id = CalculateDamage(0, NULL); - break; + spell_id = CalculateDamage(0, NULL); + break; } break; } diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 8a58ce3c52a..14dd32a71b6 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -468,6 +468,16 @@ void SpellScript::PreventHitAura() m_spell->m_spellAura->Remove(); } +void SpellScript::GetSummonPosition(uint32 i, Position &pos, float radius = 0.0f, uint32 count = 0) +{ + m_spell->GetSummonPosition(i, pos, radius, count); +} + +void SpellScript::SearchAreaTarget(std::list &TagUnitMap, float radius, SpellNotifyPushType type, SpellTargets TargetType, uint32 entry) +{ + m_spell->SearchAreaTarget(TagUnitMap, radius, type, TargetType, entry); +} + void SpellScript::PreventHitEffect(SpellEffIndex effIndex) { if (!IsInHitPhase() && !IsInEffectHook()) diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 945a62674d9..09b9eaebd62 100755 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -21,6 +21,7 @@ #include "Util.h" #include "SharedDefines.h" #include "SpellAuraDefines.h" +#include "Spell.h" #include class Unit; @@ -333,7 +334,9 @@ class SpellScript : public _SpellScript int32 GetHitHeal(); void SetHitHeal(int32 heal); void PreventHitHeal() { SetHitHeal(0); } - + Spell* GetSpell() { return m_spell; } + void GetSummonPosition(uint32 i, Position &pos, float radius, uint32 count); + void SearchAreaTarget(std::list &TagUnitMap, float radius, SpellNotifyPushType type, SpellTargets TargetType, uint32 entry); // returns current spell hit target aura Aura* GetHitAura(); // prevents applying aura on current spell hit target diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index 7977fa4df8a..e308cc59708 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -15,7 +15,6 @@ * with this program. If not, see . */ -#include "ScriptPCH.h" #include "naxxramas.h" //Stalagg @@ -87,7 +86,9 @@ enum ThaddiusSpells SPELL_POSITIVE_CHARGE = 28062, SPELL_POSITIVE_CHARGE_STACK = 29659, SPELL_NEGATIVE_CHARGE = 28085, - SPELL_NEGATIVE_CHARGE_STACK = 29660 + SPELL_NEGATIVE_CHARGE_STACK = 29660, + SPELL_POSITIVE_POLARITY = 28059, + SPELL_NEGATIVE_POLARITY = 28084, }; enum Events @@ -503,6 +504,41 @@ class spell_thaddius_pos_neg_charge : public SpellScriptLoader } }; +class spell_thaddius_polarity_shift : public SpellScriptLoader +{ + public: + spell_thaddius_polarity_shift() : SpellScriptLoader("spell_thaddius_polarity_shift") { } + + class spell_thaddius_polarity_shift_SpellScript : public SpellScript + { + PrepareSpellScript(spell_thaddius_polarity_shift_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_POSITIVE_POLARITY) || !sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_POLARITY)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) + target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, NULL, NULL, caster->GetGUID()); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_thaddius_polarity_shift_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_thaddius_polarity_shift_SpellScript(); + } +}; + class achievement_polarity_switch : public AchievementCriteriaScript { public: @@ -520,5 +556,6 @@ void AddSC_boss_thaddius() new mob_stalagg(); new mob_feugen(); new spell_thaddius_pos_neg_charge(); + new spell_thaddius_polarity_shift(); new achievement_polarity_switch(); } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 2bc2284a246..8c637bc4e90 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -34,6 +34,7 @@ #include "Vehicle.h" #include "VehicleDefines.h" #include "ulduar.h" +#include "Spell.h" enum Spells { @@ -1718,6 +1719,67 @@ class spell_pursue : public SpellScriptLoader } }; +class spell_vehicle_throw_passenger : public SpellScriptLoader +{ + public: + spell_vehicle_throw_passenger() : SpellScriptLoader("spell_vehicle_throw_passenger") {} + + class spell_vehicle_throw_passenger_SpellScript : public SpellScript + { + PrepareSpellScript(spell_vehicle_throw_passenger_SpellScript); + void HandleScript(SpellEffIndex effIndex) + { + Spell* baseSpell = GetSpell(); + SpellCastTargets targets = baseSpell->m_targets; + int32 damage = GetEffectValue(); + if (targets.HasTraj()) + if (Vehicle* vehicle = GetCaster()->GetVehicleKit()) + if (Unit* passenger = vehicle->GetPassenger(damage - 1)) + { + std::list unitList; + // use 99 because it is 3d search + SearchAreaTarget(unitList, 99, PUSH_DST_CENTER, SPELL_TARGETS_ENTRY, NPC_SEAT); + float minDist = 99 * 99; + Unit* target = NULL; + for (std::list::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) + { + if (Vehicle* seat = (*itr)->GetVehicleKit()) + if (!seat->GetPassenger(0)) + if (Unit* device = seat->GetPassenger(2)) + if (!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + { + float dist = (*itr)->GetExactDistSq(targets.GetDst()); + if (dist < minDist) + { + minDist = dist; + target = (*itr); + } + } + } + if (target && target->IsWithinDist2d(targets.GetDst(), GetSpellInfo()->Effects[effIndex].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct + passenger->EnterVehicle(target, 0); + else + { + passenger->ExitVehicle(); + float x, y, z; + targets.GetDst()->GetPosition(x, y, z); + passenger->GetMotionMaster()->MoveJump(x, y, z, targets.GetSpeedXY(), targets.GetSpeedZ()); + } + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_vehicle_throw_passenger_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_vehicle_throw_passenger_SpellScript(); + } +}; + void AddSC_boss_flame_leviathan() { new boss_flame_leviathan(); @@ -1752,4 +1814,5 @@ void AddSC_boss_flame_leviathan() new spell_auto_repair(); new spell_systems_shutdown(); new spell_pursue(); + new spell_vehicle_throw_passenger(); } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index 218c5a122f1..4917fb25153 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -23,7 +23,6 @@ SDComment: SDCategory: Tempest Keep, The Eye EndScriptData */ -#include "ScriptPCH.h" #include "the_eye.h" enum eEnums @@ -40,6 +39,7 @@ enum eEnums SPELL_ARCANE_MISSILES = 33031, SPELL_WRATH_OF_THE_ASTROMANCER = 42783, + SPELL_WRATH_OF_THE_ASTROMANCER_DOT = 42784, SPELL_BLINDING_LIGHT = 33009, SPELL_FEAR = 34322, SPELL_VOID_BOLT = 39329, @@ -491,9 +491,74 @@ class mob_solarium_priest : public CreatureScript return new mob_solarium_priestAI (Creature); } }; + +class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader +{ + public: + spell_astromancer_wrath_of_the_astromancer() : SpellScriptLoader("spell_astromancer_wrath_of_the_astromancer") { } + + class spell_astromancer_wrath_of_the_astromancer_SpellScript : public SpellScript + { + PrepareSpellScript(spell_astromancer_wrath_of_the_astromancer_SpellScript); + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_WRATH_OF_THE_ASTROMANCER_DOT)) + return false; + return true; + } + + bool Load() + { + _targetCount = 0; + return true; + } + + void CountTargets(std::list& targetList) + { + _targetCount = targetList.size(); + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + if (Unit* caster = GetOriginalCaster()) + if (Unit* target = GetHitUnit()) + { + if (!target->isAlive() || !_targetCount) + return; + + int32 damage = 10000 / _targetCount; + + SpellNonMeleeDamage damageInfo(caster, target, GetSpellInfo()->Id, GetSpellInfo()->SchoolMask); + damageInfo.damage = damage; + + caster->CalcAbsorbResist(target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &damageInfo.absorb, &damageInfo.resist, GetSpellInfo()); + caster->DealDamageMods(target, damageInfo.damage, &damageInfo.absorb); + caster->SendSpellNonMeleeDamageLog(&damageInfo); + caster->DealSpellDamage(&damageInfo, false); + } + } + + private: + int32 _targetCount; + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnUnitTargetSelect += SpellUnitTargetFn(spell_astromancer_wrath_of_the_astromancer_SpellScript::CountTargets, EFFECT_0, TARGET_DEST_CASTER_RADIUS); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_astromancer_wrath_of_the_astromancer_SpellScript(); + } +}; + void AddSC_boss_high_astromancer_solarian() { new boss_high_astromancer_solarian(); new mob_solarium_priest(); + new spell_astromancer_wrath_of_the_astromancer(); } diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp index ed818fb13be..3579a7d697b 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_mechano_lord_capacitus.cpp @@ -22,20 +22,22 @@ enum Spells { - SPELL_POSITIVE_CHARGE = 39090, + SPELL_POSITIVE_POLARITY = 39088, SPELL_POSITIVE_CHARGE_STACK = 39089, + SPELL_POSITIVE_CHARGE = 39090, + SPELL_NEGATIVE_POLARITY = 39091, + SPELL_NEGATIVE_CHARGE_STACK = 39092, SPELL_NEGATIVE_CHARGE = 39093, - SPELL_NEGATIVE_CHARGE_STACK = 39092 }; -class spell_capacitus_polarity_shift : public SpellScriptLoader +class spell_capacitus_polarity_charge : public SpellScriptLoader { public: - spell_capacitus_polarity_shift() : SpellScriptLoader("spell_capacitus_polarity_shift") { } + spell_capacitus_polarity_charge() : SpellScriptLoader("spell_capacitus_polarity_charge") { } - class spell_capacitus_polarity_shift_SpellScript : public SpellScript + class spell_capacitus_polarity_charge_SpellScript : public SpellScript { - PrepareSpellScript(spell_capacitus_polarity_shift_SpellScript); + PrepareSpellScript(spell_capacitus_polarity_charge_SpellScript); bool Validate(SpellInfo const* /*spell*/) { @@ -85,8 +87,44 @@ class spell_capacitus_polarity_shift : public SpellScriptLoader void Register() { - OnEffectHitTarget += SpellEffectFn(spell_capacitus_polarity_shift_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); - OnUnitTargetSelect += SpellUnitTargetFn(spell_capacitus_polarity_shift_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + OnEffectHitTarget += SpellEffectFn(spell_capacitus_polarity_charge_SpellScript::HandleDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + OnUnitTargetSelect += SpellUnitTargetFn(spell_capacitus_polarity_charge_SpellScript::HandleTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_capacitus_polarity_charge_SpellScript(); + } +}; + +class spell_capacitus_polarity_shift : public SpellScriptLoader +{ + public: + spell_capacitus_polarity_shift() : SpellScriptLoader("spell_capacitus_polarity_shift") { } + + class spell_capacitus_polarity_shift_SpellScript : public SpellScript + { + PrepareSpellScript(spell_capacitus_polarity_shift_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_POSITIVE_POLARITY) || !sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_POLARITY)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* target = GetHitUnit(); + Unit* caster = GetCaster(); + + target->CastSpell(target, roll_chance_i(50) ? SPELL_POSITIVE_POLARITY : SPELL_NEGATIVE_POLARITY, true, NULL, NULL, caster->GetGUID()); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_capacitus_polarity_shift_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; @@ -98,5 +136,6 @@ class spell_capacitus_polarity_shift : public SpellScriptLoader void AddSC_boss_mechano_lord_capacitus() { + new spell_capacitus_polarity_charge(); new spell_capacitus_polarity_shift(); } diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 5c0f6bcce59..2d90b5346a4 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -21,7 +21,6 @@ * Scriptnames of files in this file should be prefixed with "spell_dk_". */ -#include "ScriptPCH.h" #include "Spell.h" enum DeathKnightSpells @@ -103,7 +102,9 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - return sSpellMgr->GetSpellInfo(DK_SPELL_RUNIC_POWER_ENERGIZE); + if (!sSpellMgr->GetSpellInfo(DK_SPELL_RUNIC_POWER_ENERGIZE)) + return false; + return true; } void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) @@ -160,17 +161,16 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - return sSpellMgr->GetSpellInfo(DK_SPELL_ANTI_MAGIC_SHELL_TALENT); + if (!sSpellMgr->GetSpellInfo(DK_SPELL_ANTI_MAGIC_SHELL_TALENT)) + return false; + return true; } void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) { SpellInfo const* talentSpell = sSpellMgr->GetSpellInfo(DK_SPELL_ANTI_MAGIC_SHELL_TALENT); amount = talentSpell->Effects[EFFECT_0].CalcValue(GetCaster()); - Unit* caster = GetCaster(); - if (!caster) - return; - if (Player* player = caster->ToPlayer()) + if (Player* player = GetCaster()->ToPlayer()) amount += int32(2 * player->GetTotalAttackPowerValue(BASE_ATTACK)); } @@ -204,9 +204,7 @@ class spell_dk_corpse_explosion : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED)) - return false; - if (!sSpellMgr->GetSpellInfo(DK_SPELL_GHOUL_EXPLODE)) + if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED) || !sSpellMgr->GetSpellInfo(DK_SPELL_GHOUL_EXPLODE)) return false; if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_VISUAL)) return false; @@ -257,6 +255,13 @@ class spell_dk_ghoul_explode : public SpellScriptLoader { PrepareSpellScript(spell_dk_ghoul_explode_SpellScript); + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED)) + return false; + return true; + } + void Suicide(SpellEffIndex /*effIndex*/) { if (Unit* unitTarget = GetHitUnit()) @@ -301,9 +306,8 @@ class spell_dk_death_gate : public SpellScriptLoader void HandleScript(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - if (!GetHitUnit()) - return; - GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), false); + if (Unit* target = GetHitUnit()) + target->CastSpell(target, GetEffectValue(), false); } void Register() @@ -567,12 +571,11 @@ public: class spell_dk_improved_blood_presence_AuraScript : public AuraScript { - PrepareAuraScript(spell_dk_improved_blood_presence_AuraScript) + PrepareAuraScript(spell_dk_improved_blood_presence_AuraScript); + bool Validate(SpellInfo const* /*entry*/) { - if (!sSpellMgr->GetSpellInfo(DK_SPELL_BLOOD_PRESENCE)) - return false; - if (!sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED)) + if (!sSpellMgr->GetSpellInfo(DK_SPELL_BLOOD_PRESENCE) || !sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED)) return false; return true; } @@ -615,12 +618,11 @@ public: class spell_dk_improved_unholy_presence_AuraScript : public AuraScript { - PrepareAuraScript(spell_dk_improved_unholy_presence_AuraScript) + PrepareAuraScript(spell_dk_improved_unholy_presence_AuraScript); + bool Validate(SpellInfo const* /*entry*/) { - if (!sSpellMgr->GetSpellInfo(DK_SPELL_UNHOLY_PRESENCE)) - return false; - if (!sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED)) + if (!sSpellMgr->GetSpellInfo(DK_SPELL_UNHOLY_PRESENCE) || !sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED)) return false; return true; } @@ -656,6 +658,141 @@ public: } }; +enum DeathStrike +{ + ICON_ID_IMPROVED_DEATH_STRIKE = 2751, + SPELL_DEATH_STRIKE_HEAL = 45470, +}; + +class spell_dk_death_strike : public SpellScriptLoader +{ + public: + spell_dk_death_strike() : SpellScriptLoader("spell_dk_death_strike") { } + + class spell_dk_death_strike_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dk_death_strike_SpellScript); + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_STRIKE_HEAL)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) + { + uint32 count = target->GetDiseasesByCaster(caster->GetGUID()); + int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier))); + // Improved Death Strike + if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, ICON_ID_IMPROVED_DEATH_STRIKE, 0)) + AddPctN(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2)); + caster->CastCustomSpell(caster, SPELL_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_dk_death_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY); + } + + }; + + SpellScript* GetSpellScript() const + { + return new spell_dk_death_strike_SpellScript(); + } +}; + +enum DeathCoil +{ + SPELL_DEATH_COIL_DAMAGE = 47632, + SPELL_DEATH_COIL_HEAL = 47633, +}; + +class spell_dk_death_coil : public SpellScriptLoader +{ + public: + spell_dk_death_coil() : SpellScriptLoader("spell_dk_death_coil") { } + + class spell_dk_death_coil_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dk_death_coil_SpellScript); + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_DAMAGE) || !sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_HEAL)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + int32 damage = GetEffectValue(); + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) + if (caster->IsFriendlyTo(target)) + { + int32 bp = int32(damage * 1.5f); + caster->CastCustomSpell(target, SPELL_DEATH_COIL_HEAL, &bp, NULL, NULL, true); + } + else + caster->CastCustomSpell(target, SPELL_DEATH_COIL_DAMAGE, &damage, NULL, NULL, true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + + }; + + SpellScript* GetSpellScript() const + { + return new spell_dk_death_coil_SpellScript(); + } +}; + +class spell_dk_death_grip : public SpellScriptLoader +{ + public: + spell_dk_death_grip() : SpellScriptLoader("spell_dk_death_grip") { } + + class spell_dk_death_grip_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dk_death_grip_SpellScript); + + void HandleDummy(SpellEffIndex effIndex) + { + int32 damage = GetEffectValue(); + Spell* baseSpell = GetSpell(); + Position pos; + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) + { + GetSummonPosition(effIndex, pos, 0.0f, 0); + + if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence + target->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_dk_death_grip_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + + }; + + SpellScript* GetSpellScript() const + { + return new spell_dk_death_grip_SpellScript(); + } +}; + void AddSC_deathknight_spell_scripts() { new spell_dk_anti_magic_shell_raid(); @@ -671,4 +808,7 @@ void AddSC_deathknight_spell_scripts() new spell_dk_will_of_the_necropolis(); new spell_dk_improved_blood_presence(); new spell_dk_improved_unholy_presence(); + new spell_dk_death_strike(); + new spell_dk_death_coil(); + new spell_dk_death_grip(); } diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 130f61565f7..58e63a7eb66 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -21,7 +21,6 @@ * Scriptnames of files in this file should be prefixed with "spell_dru_". */ -#include "ScriptPCH.h" #include "SpellAuraEffects.h" enum DruidSpells @@ -42,9 +41,7 @@ class spell_dru_glyph_of_starfire : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(DRUID_INCREASED_MOONFIRE_DURATION)) - return false; - if (!sSpellMgr->GetSpellInfo(DRUID_NATURES_SPLENDOR)) + if (!sSpellMgr->GetSpellInfo(DRUID_INCREASED_MOONFIRE_DURATION) || !sSpellMgr->GetSpellInfo(DRUID_NATURES_SPLENDOR)) return false; return true; } @@ -305,14 +302,16 @@ class spell_dru_swift_flight_passive : public SpellScriptLoader { PrepareAuraScript(spell_dru_swift_flight_passive_AuraScript); - void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) + bool Load() { - Unit* caster = GetCaster(); - if (!caster || !caster->ToPlayer()) - return; + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - if (caster->ToPlayer()->Has310Flyer(false)) - amount = 310; + void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) + { + if (Player* caster = GetCaster()->ToPlayer()) + if (caster->Has310Flyer(false)) + amount = 310; } void Register() @@ -327,6 +326,47 @@ class spell_dru_swift_flight_passive : public SpellScriptLoader } }; +class spell_dru_starfall_dummy : public SpellScriptLoader +{ + public: + spell_dru_starfall_dummy() : SpellScriptLoader("spell_dru_starfall_dummy") { } + + class spell_dru_starfall_dummy_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dru_starfall_dummy_SpellScript); + + void HandleDummy(SpellEffIndex /* effIndex */) + { + if (GetTriggeringSpell()) + sLog->outString("triggering spell = %u",GetTriggeringSpell()->Id); + + Unit* caster = GetCaster(); + if (caster->IsInDisallowedMountForm() || caster->IsMounted()) + { + if (SpellInfo const* spellInfo = GetTriggeringSpell()) + caster->RemoveAurasDueToSpell(spellInfo->Id); + return; + } + + //Any effect which causes you to lose control of your character will supress the starfall effect. + if (caster->HasUnitState(UNIT_STATE_CONTROLLED)) + return; + + caster->CastSpell(GetHitUnit(), GetEffectValue(), true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_dru_starfall_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_dru_starfall_dummy_SpellScript(); + } +}; + void AddSC_druid_spell_scripts() { new spell_dru_glyph_of_starfire(); @@ -336,4 +376,5 @@ void AddSC_druid_spell_scripts() new spell_dru_t10_restoration_4p_bonus(); new spell_dru_starfall_aoe(); new spell_dru_swift_flight_passive(); + new spell_dru_starfall_dummy(); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 4529e7b049d..a34b16a9c22 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -22,7 +22,6 @@ * Scriptnames of files in this file should be prefixed with "spell_gen_" */ -#include "ScriptPCH.h" #include "SpellAuraEffects.h" #include "SkillDiscovery.h" #include "GridNotifiers.h" @@ -236,9 +235,7 @@ class spell_gen_parachute : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE_BUFF)) + if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE) || !sSpellMgr->GetSpellInfo(SPELL_PARACHUTE_BUFF)) return false; return true; } @@ -246,13 +243,11 @@ class spell_gen_parachute : public SpellScriptLoader void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) { if (Player* target = GetTarget()->ToPlayer()) - { if (target->IsFalling()) { target->RemoveAurasDueToSpell(SPELL_PARACHUTE); target->CastSpell(target, SPELL_PARACHUTE_BUFF, true); } - } } void Register() @@ -283,13 +278,14 @@ class spell_gen_pet_summoned : public SpellScriptLoader { PrepareSpellScript(spell_gen_pet_summoned_SpellScript); - void HandleScript(SpellEffIndex /*effIndex*/) + bool Load() { - Unit* caster = GetCaster(); - if (caster->GetTypeId() != TYPEID_PLAYER) - return; + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - Player* player = caster->ToPlayer(); + void HandleScript(SpellEffIndex /*effIndex*/) + { + Player* player = GetCaster()->ToPlayer(); if (player->GetLastPetNumber()) { PetType newPetType = (player->getClass() == CLASS_HUNTER) ? HUNTER_PET : SUMMON_PET; @@ -340,10 +336,14 @@ class spell_gen_remove_flight_auras : public SpellScriptLoader class spell_gen_remove_flight_auras_SpellScript : public SpellScript { PrepareSpellScript(spell_gen_remove_flight_auras_SpellScript); + void HandleScript(SpellEffIndex /*effIndex*/) { - GetHitUnit()->RemoveAurasByType(SPELL_AURA_FLY); - GetHitUnit()->RemoveAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED); + if (Unit* target = GetHitUnit()) + { + target->RemoveAurasByType(SPELL_AURA_FLY); + target->RemoveAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED); + } } void Register() @@ -376,22 +376,21 @@ class spell_gen_leeching_swarm : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_DMG)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_HEAL)) + if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_DMG) || !sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_HEAL)) return false; return true; } void HandleEffectPeriodic(AuraEffect const* aurEff) { - if (Unit* caster = GetCaster()) + Unit* caster = GetCaster(); + if (Unit* target = GetTarget()) { - int32 lifeLeeched = GetTarget()->CountPctFromCurHealth(aurEff->GetAmount()); + int32 lifeLeeched = target->CountPctFromCurHealth(aurEff->GetAmount()); if (lifeLeeched < 250) lifeLeeched = 250; // Damage - caster->CastCustomSpell(GetTarget(), SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, false); + caster->CastCustomSpell(target, SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, false); // Heal caster->CastCustomSpell(caster, SPELL_LEECHING_SWARM_HEAL, &lifeLeeched, 0, 0, false); } @@ -500,31 +499,16 @@ class spell_gen_trick : public SpellScriptLoader PrepareSpellScript(spell_gen_trick_SpellScript); bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_MALE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_FEMALE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_MALE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_FEMALE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_MALE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_FEMALE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SKELETON_COSTUME)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_MALE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_FEMALE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_TRICK_BUFF)) + if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_MALE) + || !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_FEMALE) + || !sSpellMgr->GetSpellInfo(SPELL_SKELETON_COSTUME) || !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_TRICK_BUFF)) return false; return true; } void HandleScript(SpellEffIndex /*effIndex*/) { + Unit* caster = GetCaster(); if (Player* target = GetHitPlayer()) { uint8 gender = target->getGender(); @@ -550,7 +534,7 @@ class spell_gen_trick : public SpellScriptLoader break; } - GetCaster()->CastSpell(target, spellId, true, NULL); + caster->CastSpell(target, spellId, true, NULL); } } @@ -585,21 +569,18 @@ class spell_gen_trick_or_treat : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_TRICK)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_TREAT)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_TRICKED_OR_TREATED)) + if (!sSpellMgr->GetSpellInfo(SPELL_TRICK) || !sSpellMgr->GetSpellInfo(SPELL_TREAT) || !sSpellMgr->GetSpellInfo(SPELL_TRICKED_OR_TREATED)) return false; return true; } void HandleScript(SpellEffIndex /*effIndex*/) { + Unit* caster = GetCaster(); if (Player* target = GetHitPlayer()) { - GetCaster()->CastSpell(target, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true, NULL); - GetCaster()->CastSpell(target, SPELL_TRICKED_OR_TREATED, true, NULL); + caster->CastSpell(target, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true, NULL); + caster->CastSpell(target, SPELL_TRICKED_OR_TREATED, true, NULL); } } @@ -661,11 +642,14 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader { PrepareSpellScript(spell_pvp_trinket_wotf_shared_cd_SpellScript); + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF)) + if (!sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF)) return false; return true; } @@ -673,10 +657,7 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { Player* caster = GetCaster()->ToPlayer(); - if (!caster) - return; SpellInfo const* spellInfo = GetSpellInfo(); - caster->AddSpellCooldown(spellInfo->Id, 0, time(NULL) + sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER)->GetRecoveryTime() / IN_MILLISECONDS); WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4); data << uint64(caster->GetGUID()); @@ -729,8 +710,9 @@ class spell_gen_animal_blood : public SpellScriptLoader void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (GetUnitOwner()->IsInWater()) - GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SPAWN_BLOOD_POOL, true); + if (Unit* owner = GetUnitOwner()) + if (owner->IsInWater()) + owner->CastSpell(owner, SPELL_SPAWN_BLOOD_POOL, true); } void Register() @@ -761,6 +743,11 @@ class spell_gen_divine_storm_cd_reset : public SpellScriptLoader { PrepareSpellScript(spell_gen_divine_storm_cd_reset_SpellScript); + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + bool Validate(SpellInfo const* /*spellEntry*/) { if (!sSpellMgr->GetSpellInfo(SPELL_DIVINE_STORM)) @@ -770,9 +757,9 @@ class spell_gen_divine_storm_cd_reset : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { - if (Player* caster = GetCaster()->ToPlayer()) - if (caster->HasSpellCooldown(SPELL_DIVINE_STORM)) - caster->RemoveSpellCooldown(SPELL_DIVINE_STORM, true); + Player* caster = GetCaster()->ToPlayer(); + if (caster->HasSpellCooldown(SPELL_DIVINE_STORM)) + caster->RemoveSpellCooldown(SPELL_DIVINE_STORM, true); } void Register() @@ -796,13 +783,15 @@ class spell_gen_gunship_portal : public SpellScriptLoader { PrepareSpellScript(spell_gen_gunship_portal_SpellScript); - void HandleScript(SpellEffIndex /*effIndex*/) + bool Load() { - Unit* caster = GetCaster(); - if (caster->GetTypeId() != TYPEID_PLAYER) - return; + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - if (Battleground* bg = caster->ToPlayer()->GetBattleground()) + void HandleScript(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + if (Battleground* bg = caster->GetBattleground()) if (bg->GetTypeID(true) == BATTLEGROUND_IC) bg->DoAction(1, caster->GetGUID()); } @@ -821,7 +810,7 @@ class spell_gen_gunship_portal : public SpellScriptLoader enum parachuteIC { - SPELL_PARACHUTE_IC = 66657 + SPELL_PARACHUTE_IC = 66657, }; class spell_gen_parachute_ic : public SpellScriptLoader @@ -835,13 +824,9 @@ class spell_gen_parachute_ic : public SpellScriptLoader void HandleTriggerSpell(AuraEffect const* /*aurEff*/) { - Unit* target = GetTarget(); - - if (!target->ToPlayer()) - return; - - if (target->ToPlayer()->m_movementInfo.fallTime > 2000) - target->CastSpell(target, SPELL_PARACHUTE_IC, true); + if (Player* target = GetTarget()->ToPlayer()) + if (target->m_movementInfo.fallTime > 2000) + target->CastSpell(target, SPELL_PARACHUTE_IC, true); } void Register() @@ -868,7 +853,7 @@ class spell_gen_dungeon_credit : public SpellScriptLoader bool Load() { _handled = false; - return true; + return GetCaster()->GetTypeId() == TYPEID_UNIT; } void CreditEncounter() @@ -878,9 +863,9 @@ class spell_gen_dungeon_credit : public SpellScriptLoader return; _handled = true; - if (GetCaster()->GetTypeId() == TYPEID_UNIT) - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - instance->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, GetSpellInfo()->Id, GetCaster()); + Unit* caster = GetCaster(); + if (InstanceScript* instance = caster->GetInstanceScript()) + instance->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, GetSpellInfo()->Id, caster); } void Register() @@ -906,9 +891,14 @@ class spell_gen_profession_research : public SpellScriptLoader { PrepareSpellScript(spell_gen_profession_research_SpellScript); + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + SpellCastResult CheckRequirement() { - if (GetCaster()->GetTypeId() == TYPEID_PLAYER && HasDiscoveredAllSpells(GetSpellInfo()->Id, GetCaster()->ToPlayer())) + if (HasDiscoveredAllSpells(GetSpellInfo()->Id, GetCaster()->ToPlayer())) { SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_NOTHING_TO_DISCOVER); return SPELL_FAILED_CUSTOM_ERROR; @@ -978,19 +968,11 @@ class spell_generic_clone_weapon : public SpellScriptLoader class spell_generic_clone_weapon_SpellScript : public SpellScript { PrepareSpellScript(spell_generic_clone_weapon_SpellScript); + bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED)) + if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3) || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND) + || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2) || !sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED)) return false; return true; } @@ -999,57 +981,56 @@ class spell_generic_clone_weapon : public SpellScriptLoader { PreventHitDefaultEffect(effIndex); Unit* caster = GetCaster(); - Unit* target = GetHitUnit(); - - if (!target) - return; + if (Unit* target = GetHitUnit()) + { - uint32 spellId = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue()); - target->CastSpell(caster, spellId, true); + uint32 spellId = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue()); + target->CastSpell(caster, spellId, true); - if (target->GetTypeId() == TYPEID_PLAYER) - return; + if (target->GetTypeId() == TYPEID_PLAYER) + return; - switch (GetSpellInfo()->Id) - { - case SPELL_COPY_WEAPON: - case SPELL_COPY_WEAPON_2: - case SPELL_COPY_WEAPON_3: + switch (GetSpellInfo()->Id) { - if (Player* player = caster->ToPlayer()) + case SPELL_COPY_WEAPON: + case SPELL_COPY_WEAPON_2: + case SPELL_COPY_WEAPON_3: { - if (Item* mainItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND)) - target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, mainItem->GetEntry()); + if (Player* player = caster->ToPlayer()) + { + if (Item* mainItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND)) + target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, mainItem->GetEntry()); + } + else + target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID)); + break; } - else - target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID)); - break; - } - case SPELL_COPY_OFFHAND: - case SPELL_COPY_OFFHAND_2: - { - if (Player* player = caster->ToPlayer()) + case SPELL_COPY_OFFHAND: + case SPELL_COPY_OFFHAND_2: { - if (Item* offItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND)) - target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, offItem->GetEntry()); + if (Player* player = caster->ToPlayer()) + { + if (Item* offItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND)) + target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, offItem->GetEntry()); + } + else + target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1)); + break; } - else - target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1)); - break; - } - case SPELL_COPY_RANGED: - { - if (Player* player = caster->ToPlayer()) + case SPELL_COPY_RANGED: { - if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED)) - target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, rangedItem->GetEntry()); + if (Player* player = caster->ToPlayer()) + { + if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED)) + target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, rangedItem->GetEntry()); + } + else + target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2)); + break; } - else - target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2)); - break; + default: + break; } - default: - break; } } @@ -1095,10 +1076,10 @@ class spell_gen_seaforium_blast : public SpellScriptLoader void AchievementCredit(SpellEffIndex /*effIndex*/) { // but in effect handling OriginalCaster can become NULL - if (!GetOriginalCaster() || !GetHitGObj() || GetHitGObj()->GetGOInfo()->type != GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING) - return; - - GetOriginalCaster()->CastSpell(GetOriginalCaster(), SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT, true); + if (Unit* originalCaster = GetOriginalCaster()) + if (GameObject* go = GetHitGObj()) + if (GetHitGObj()->GetGOInfo()->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING) + originalCaster->CastSpell(originalCaster, SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT, true); } void Register() @@ -1131,10 +1112,11 @@ class spell_gen_turkey_marker : public SpellScriptLoader { // store stack apply times, so we can pop them while they expire _applyTimes.push_back(getMSTime()); + Unit* target = GetTarget(); // on stack 15 cast the achievement crediting spell if (GetStackAmount() >= 15) - GetTarget()->CastSpell(GetTarget(), SPELL_TURKEY_VENGEANCE, true, NULL, aurEff, GetCasterGUID()); + target->CastSpell(target, SPELL_TURKEY_VENGEANCE, true, NULL, aurEff, GetCasterGUID()); } void OnPeriodic(AuraEffect const* /*aurEff*/) @@ -1208,29 +1190,28 @@ class spell_gen_magic_rooster : public SpellScriptLoader void HandleScript(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - Player* target = GetHitPlayer(); - if (!target) - return; + if (Player* target = GetHitPlayer()) + { + // prevent client crashes from stacking mounts + target->RemoveAurasByType(SPELL_AURA_MOUNTED); - // prevent client crashes from stacking mounts - target->RemoveAurasByType(SPELL_AURA_MOUNTED); + uint32 spellId = SPELL_MAGIC_ROOSTER_NORMAL; + switch (target->getRace()) + { + case RACE_DRAENEI: + if (target->getGender() == GENDER_MALE) + spellId = SPELL_MAGIC_ROOSTER_DRAENEI_MALE; + break; + case RACE_TAUREN: + if (target->getGender() == GENDER_MALE) + spellId = SPELL_MAGIC_ROOSTER_TAUREN_MALE; + break; + default: + break; + } - uint32 spellId = SPELL_MAGIC_ROOSTER_NORMAL; - switch (target->getRace()) - { - case RACE_DRAENEI: - if (target->getGender() == GENDER_MALE) - spellId = SPELL_MAGIC_ROOSTER_DRAENEI_MALE; - break; - case RACE_TAUREN: - if (target->getGender() == GENDER_MALE) - spellId = SPELL_MAGIC_ROOSTER_TAUREN_MALE; - break; - default: - break; + target->CastSpell(target, spellId, true); } - - target->CastSpell(target, spellId, true); } void Register() @@ -1258,7 +1239,6 @@ public: { if (!GetCastItem()) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - return SPELL_CAST_OK; } @@ -1335,12 +1315,14 @@ class spell_gen_vehicle_scaling : public SpellScriptLoader { PrepareAuraScript(spell_gen_vehicle_scaling_AuraScript); + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/) { Unit* caster = GetCaster(); - if (!caster || !caster->ToPlayer()) - return; - float factor; uint16 baseItemLevel; @@ -1379,21 +1361,23 @@ class spell_gen_vehicle_scaling : public SpellScriptLoader }; -class spell_gen_oracle_wolvar_reputation: public SpellScriptLoader +class spell_gen_oracle_wolvar_reputation : public SpellScriptLoader { -public: - spell_gen_oracle_wolvar_reputation() : SpellScriptLoader("spell_gen_oracle_wolvar_reputation") { } - - class spell_gen_oracle_wolvar_reputation_SpellScript : public SpellScript - { - PrepareSpellScript(spell_gen_oracle_wolvar_reputation_SpellScript) + public: + spell_gen_oracle_wolvar_reputation() : SpellScriptLoader("spell_gen_oracle_wolvar_reputation") { } - void HandleDummy(SpellEffIndex effIndex) + class spell_gen_oracle_wolvar_reputation_SpellScript : public SpellScript { + PrepareSpellScript(spell_gen_oracle_wolvar_reputation_SpellScript); - if (Player* player = GetCaster()->ToPlayer()) + bool Load() { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + void HandleDummy(SpellEffIndex effIndex) + { + Player* player = GetCaster()->ToPlayer(); uint32 factionId = GetSpellInfo()->Effects[effIndex].CalcValue(); int32 repChange = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); @@ -1410,18 +1394,16 @@ public: // EFFECT_INDEX_2 most likely update at war state, we already handle this in SetReputation } - } + void Register() + { + OnEffectHit += SpellEffectFn(spell_gen_oracle_wolvar_reputation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - void Register() + SpellScript* GetSpellScript() const { - OnEffectHit += SpellEffectFn(spell_gen_oracle_wolvar_reputation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_gen_oracle_wolvar_reputation_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_gen_oracle_wolvar_reputation_SpellScript(); - } }; enum DamageReductionAura @@ -1435,53 +1417,48 @@ enum DamageReductionAura class spell_gen_damage_reduction_aura : public SpellScriptLoader { -public: - spell_gen_damage_reduction_aura() : SpellScriptLoader("spell_gen_damage_reduction_aura") { } - - class spell_gen_damage_reduction_AuraScript : public AuraScript - { - PrepareAuraScript(spell_gen_damage_reduction_AuraScript); + public: + spell_gen_damage_reduction_aura() : SpellScriptLoader("spell_gen_damage_reduction_aura") { } - bool Validate(SpellInfo const* /*SpellEntry*/) + class spell_gen_damage_reduction_AuraScript : public AuraScript { - if (!sSpellMgr->GetSpellInfo(SPELL_DAMAGE_REDUCTION_AURA)) - return false; - return true; - } + PrepareAuraScript(spell_gen_damage_reduction_AuraScript); - void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - target->CastSpell(target, SPELL_DAMAGE_REDUCTION_AURA, true); - } + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_DAMAGE_REDUCTION_AURA)) + return false; + return true; + } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - if (!target->HasAura(SPELL_DAMAGE_REDUCTION_AURA)) - return; + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + target->CastSpell(target, SPELL_DAMAGE_REDUCTION_AURA, true); + } - if (target->HasAura(SPELL_BLESSING_OF_SANCTUARY) || - target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) || - target->HasAura(SPELL_RENEWED_HOPE) || - target->HasAura(SPELL_VIGILANCE)) - return; + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + if (target->HasAura(SPELL_DAMAGE_REDUCTION_AURA) && !(target->HasAura(SPELL_BLESSING_OF_SANCTUARY) || + target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) || + target->HasAura(SPELL_RENEWED_HOPE) || + target->HasAura(SPELL_VIGILANCE))) + target->RemoveAurasDueToSpell(SPELL_DAMAGE_REDUCTION_AURA); + } - target->RemoveAurasDueToSpell(SPELL_DAMAGE_REDUCTION_AURA); - } + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_gen_damage_reduction_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + OnEffectRemove += AuraEffectRemoveFn(spell_gen_damage_reduction_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } - void Register() + }; + + AuraScript* GetAuraScript() const { - OnEffectApply += AuraEffectApplyFn(spell_gen_damage_reduction_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - OnEffectRemove += AuraEffectRemoveFn(spell_gen_damage_reduction_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + return new spell_gen_damage_reduction_AuraScript(); } - - }; - - AuraScript* GetAuraScript() const - { - return new spell_gen_damage_reduction_AuraScript(); - } }; class spell_gen_luck_of_the_draw : public SpellScriptLoader @@ -1493,6 +1470,11 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader { PrepareAuraScript(spell_gen_luck_of_the_draw_AuraScript); + bool Load() + { + return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER; + } + // cheap hax to make it have update calls void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude) { @@ -1502,30 +1484,30 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader void Update(AuraEffect* /*effect*/) { - if (GetUnitOwner()->GetTypeId() != TYPEID_PLAYER) - return; - - const LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(GetUnitOwner()->GetGUID()); - LfgDungeonSet::const_iterator itr = dungeons.begin(); - - if (itr == dungeons.end()) + if (Player* owner = GetUnitOwner()->ToPlayer()) { - Remove(AURA_REMOVE_BY_DEFAULT); - return; - } + const LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(owner->GetGUID()); + LfgDungeonSet::const_iterator itr = dungeons.begin(); + if (itr == dungeons.end()) + { + Remove(AURA_REMOVE_BY_DEFAULT); + return; + } - LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*itr); - Group* group = GetUnitOwner()->ToPlayer()->GetGroup(); - Map const* map = GetUnitOwner()->GetMap(); - if (group && group->isLFGGroup()) - if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) - if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) - if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) - if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM) - return; // in correct dungeon - Remove(AURA_REMOVE_BY_DEFAULT); + LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*itr); + if (Group* group = owner->GetGroup()) + if (Map const* map = owner->GetMap()) + if (group->isLFGGroup()) + if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) + if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) + if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM) + return; // in correct dungeon + + Remove(AURA_REMOVE_BY_DEFAULT); + } } void Register() @@ -1541,6 +1523,178 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader } }; +enum DummyTrigger +{ + SPELL_PERSISTANT_SHIELD_TRIGGERED = 26470, + SPELL_PERSISTANT_SHIELD = 26467, +}; + +class spell_gen_dummy_trigger : public SpellScriptLoader +{ + public: + spell_gen_dummy_trigger() : SpellScriptLoader("spell_gen_dummy_trigger") { } + + class spell_gen_dummy_trigger_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_dummy_trigger_SpellScript); + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_PERSISTANT_SHIELD_TRIGGERED) || !sSpellMgr->GetSpellInfo(SPELL_PERSISTANT_SHIELD)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + int32 damage = GetEffectValue(); + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) + if (SpellInfo const* triggeredByAuraSpell = GetTriggeringSpell()) + if (triggeredByAuraSpell->Id == SPELL_PERSISTANT_SHIELD_TRIGGERED) + caster->CastCustomSpell(target, SPELL_PERSISTANT_SHIELD_TRIGGERED, &damage, NULL, NULL, true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_dummy_trigger_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_dummy_trigger_SpellScript(); + } + +}; + +class spell_gen_spirit_healer_res : public SpellScriptLoader +{ + public: + spell_gen_spirit_healer_res(): SpellScriptLoader("spell_gen_spirit_healer_res") { } + + class spell_gen_spirit_healer_res_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_spirit_healer_res_SpellScript); + + bool Load() + { + return GetOriginalCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + if (Player* originalCaster = GetOriginalCaster()->ToPlayer()) + { + if (Unit* target = GetHitUnit()) + { + WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8); + data << uint64(target->GetGUID()); + originalCaster->GetSession()->SendPacket(&data); + } + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_spirit_healer_res_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_spirit_healer_res_SpellScript(); + } +}; + +enum TransporterBackfires +{ + SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH = 23444, + SPELL_TRANSPORTER_EVIL_TWIN = 23445, + SPELL_TRANSPORTER_MALFUNCTION_MISS = 36902, +}; + +class spell_gen_gadgetzan_transporter_backfire : public SpellScriptLoader +{ + public: + spell_gen_gadgetzan_transporter_backfire() : SpellScriptLoader("spell_gen_gadgetzan_transporter_backfire") { } + + class spell_gen_gadgetzan_transporter_backfire_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_gadgetzan_transporter_backfire_SpellScript) + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH) || !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_EVIL_TWIN) + || !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_MALFUNCTION_MISS)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + int32 r = irand(0, 119); + if (r < 20) // Transporter Malfunction - 1/6 polymorph + caster->CastSpell(caster, SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH, true); + else if (r < 100) // Evil Twin - 4/6 evil twin + caster->CastSpell(caster, SPELL_TRANSPORTER_EVIL_TWIN, true); + else // Transporter Malfunction - 1/6 miss the target + caster->CastSpell(caster, SPELL_TRANSPORTER_MALFUNCTION_MISS, true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_gadgetzan_transporter_backfire_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_gadgetzan_transporter_backfire_SpellScript(); + } +}; + +enum GnomishTransporter +{ + SPELL_TRANSPORTER_SUCCESS = 23441, + SPELL_TRANSPORTER_FAILURE = 23446, +}; + +class spell_gen_gnomish_transporter : public SpellScriptLoader +{ + public: + spell_gen_gnomish_transporter() : SpellScriptLoader("spell_gen_gnomish_transporter") { } + + class spell_gen_gnomish_transporter_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_gnomish_transporter_SpellScript) + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_SUCCESS) || !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_FAILURE)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + caster->CastSpell(caster, roll_chance_i(50) ? SPELL_TRANSPORTER_SUCCESS : SPELL_TRANSPORTER_FAILURE , true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_gnomish_transporter_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_gnomish_transporter_SpellScript(); + } +}; + enum DalaranDisguiseSpells { SPELL_SUNREAVER_DISGUISE_TRIGGER = 69672, @@ -1565,15 +1719,11 @@ class spell_gen_dalaran_disguise : public SpellScriptLoader switch (spellEntry->Id) { case SPELL_SUNREAVER_DISGUISE_TRIGGER: - if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_FEMALE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_MALE)) + if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_MALE)) return false; break; case SPELL_SILVER_COVENANT_DISGUISE_TRIGGER: - if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_FEMALE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_MALE)) + if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_MALE)) return false; break; } @@ -1599,7 +1749,6 @@ class spell_gen_dalaran_disguise : public SpellScriptLoader default: break; } - GetCaster()->CastSpell(player, spellId, true); } } @@ -2354,6 +2503,47 @@ class spell_gen_tournament_pennant : public SpellScriptLoader } }; +enum ChaosBlast +{ + SPELL_CHAOS_BLAST = 37675, +}; + +class spell_gen_chaos_blast : public SpellScriptLoader +{ + public: + spell_gen_chaos_blast() : SpellScriptLoader("spell_gen_chaos_blast") { } + + class spell_gen_chaos_blast_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_chaos_blast_SpellScript) + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_CHAOS_BLAST)) + return false; + return true; + } + void HandleDummy(SpellEffIndex /* effIndex */) + { + int32 basepoints0 = 100; + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) + caster->CastCustomSpell(target, SPELL_CHAOS_BLAST, &basepoints0, NULL, NULL, true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_chaos_blast_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_chaos_blast_SpellScript(); + } + +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -2387,6 +2577,10 @@ void AddSC_generic_spell_scripts() new spell_gen_oracle_wolvar_reputation(); new spell_gen_damage_reduction_aura(); new spell_gen_luck_of_the_draw(); + new spell_gen_dummy_trigger(); + new spell_gen_spirit_healer_res(); + new spell_gen_gadgetzan_transporter_backfire(); + new spell_gen_gnomish_transporter(); new spell_gen_dalaran_disguise("spell_gen_sunreaver_disguise"); new spell_gen_dalaran_disguise("spell_gen_silver_covenant_disguise"); new spell_gen_elune_candle(); @@ -2398,4 +2592,5 @@ void AddSC_generic_spell_scripts() new spell_gen_summon_tournament_mount(); new spell_gen_on_tournament_mount(); new spell_gen_tournament_pennant(); + new spell_gen_chaos_blast(); } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 8a3424ab1e7..13ad05b1930 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -21,7 +21,6 @@ * Scriptnames of files in this file should be prefixed with "spell_hun_". */ -#include "ScriptPCH.h" #include "SpellAuraEffects.h" #include "GridNotifiers.h" @@ -45,219 +44,215 @@ enum HunterSpells // 13161 Aspect of the Beast class spell_hun_aspect_of_the_beast : public SpellScriptLoader { -public: - spell_hun_aspect_of_the_beast() : SpellScriptLoader("spell_hun_aspect_of_the_beast") { } - - class spell_hun_aspect_of_the_beast_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hun_aspect_of_the_beast_AuraScript) - bool Validate(SpellInfo const* /*entry*/) - { - if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET)) - return false; - return true; - } + public: + spell_hun_aspect_of_the_beast() : SpellScriptLoader("spell_hun_aspect_of_the_beast") { } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + class spell_hun_aspect_of_the_beast_AuraScript : public AuraScript { - if (!GetCaster()) - return; + PrepareAuraScript(spell_hun_aspect_of_the_beast_AuraScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + bool Validate(SpellInfo const* /*entry*/) + { + if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET)) + return false; + return true; + } - Unit* caster = GetCaster(); - if (caster->ToPlayer()) - if (Pet* pet = caster->ToPlayer()->GetPet()) - pet->RemoveAurasDueToSpell(HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET); - } + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Player* caster = GetCaster()->ToPlayer()) + if (Pet* pet = caster->GetPet()) + pet->RemoveAurasDueToSpell(HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET); + } - void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - if (!GetCaster()) - return; + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Player* caster = GetCaster()->ToPlayer()) + if (caster->GetPet()) + caster->CastSpell(caster, HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET, true); + } - Unit* caster = GetCaster(); - if (caster->ToPlayer()) - if (caster->ToPlayer()->GetPet()) - caster->CastSpell(caster, HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET, true); - } + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_hun_aspect_of_the_beast_AuraScript::OnApply, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_hun_aspect_of_the_beast_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL); + } + }; - void Register() + AuraScript* GetAuraScript() const { - AfterEffectApply += AuraEffectApplyFn(spell_hun_aspect_of_the_beast_AuraScript::OnApply, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_hun_aspect_of_the_beast_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_UNTRACKABLE, AURA_EFFECT_HANDLE_REAL); + return new spell_hun_aspect_of_the_beast_AuraScript(); } - }; - - AuraScript* GetAuraScript() const - { - return new spell_hun_aspect_of_the_beast_AuraScript(); - } }; // 53209 Chimera Shot class spell_hun_chimera_shot : public SpellScriptLoader { -public: - spell_hun_chimera_shot() : SpellScriptLoader("spell_hun_chimera_shot") { } + public: + spell_hun_chimera_shot() : SpellScriptLoader("spell_hun_chimera_shot") { } - class spell_hun_chimera_shot_SpellScript : public SpellScript - { - PrepareSpellScript(spell_hun_chimera_shot_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) + class spell_hun_chimera_shot_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_SERPENT)) - return false; - if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_VIPER)) - return false; - if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_SCORPID)) - return false; - return true; - } + PrepareSpellScript(spell_hun_chimera_shot_SpellScript); - void HandleScriptEffect(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - Unit* unitTarget = GetHitUnit(); - if (!unitTarget) - return; - - uint32 spellId = 0; - int32 basePoint = 0; - Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras(); - for (Unit::AuraApplicationMap::iterator i = Auras.begin(); i != Auras.end(); ++i) - { - Aura* aura = i->second->GetBase(); - if (aura->GetCasterGUID() != caster->GetGUID()) - continue; - - // Search only Serpent Sting, Viper Sting, Scorpid Sting auras - flag96 familyFlag = aura->GetSpellInfo()->SpellFamilyFlags; - if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000)) - continue; - if (AuraEffect const* aurEff = aura->GetEffect(0)) + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_SERPENT) || !sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_VIPER) || !sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_SCORPID)) + return false; + return true; + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Unit* unitTarget = GetHitUnit()) { - // Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting. - if (familyFlag[0] & 0x4000) - { - int32 TickCount = aurEff->GetTotalTicks(); - spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT; - basePoint = caster->SpellDamageBonus(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount()); - ApplyPctN(basePoint, TickCount * 40); - } - // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting. - else if (familyFlag[1] & 0x00000080) + uint32 spellId = 0; + int32 basePoint = 0; + Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras(); + for (Unit::AuraApplicationMap::iterator i = Auras.begin(); i != Auras.end(); ++i) { - int32 TickCount = aura->GetEffect(0)->GetTotalTicks(); - spellId = HUNTER_SPELL_CHIMERA_SHOT_VIPER; - - // Amount of one aura tick - basePoint = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount())); - int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50; // TODO: WTF? caster uses unitTarget? - if (basePoint > casterBasePoint) - basePoint = casterBasePoint; - ApplyPctN(basePoint, TickCount * 60); + Aura* aura = i->second->GetBase(); + if (aura->GetCasterGUID() != caster->GetGUID()) + continue; + + // Search only Serpent Sting, Viper Sting, Scorpid Sting auras + flag96 familyFlag = aura->GetSpellInfo()->SpellFamilyFlags; + if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000)) + continue; + if (AuraEffect const* aurEff = aura->GetEffect(0)) + { + // Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting. + if (familyFlag[0] & 0x4000) + { + int32 TickCount = aurEff->GetTotalTicks(); + spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT; + basePoint = caster->SpellDamageBonus(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount()); + ApplyPctN(basePoint, TickCount * 40); + } + // Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting. + else if (familyFlag[1] & 0x00000080) + { + int32 TickCount = aura->GetEffect(0)->GetTotalTicks(); + spellId = HUNTER_SPELL_CHIMERA_SHOT_VIPER; + + // Amount of one aura tick + basePoint = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount())); + int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50; // TODO: WTF? caster uses unitTarget? + if (basePoint > casterBasePoint) + basePoint = casterBasePoint; + ApplyPctN(basePoint, TickCount * 60); + } + // Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute. + else if (familyFlag[0] & 0x00008000) + spellId = HUNTER_SPELL_CHIMERA_SHOT_SCORPID; + // ?? nothing say in spell desc (possibly need addition check) + //if (familyFlag & 0x0000010000000000LL || // dot + // familyFlag & 0x0000100000000000LL) // stun + //{ + // spellId = 53366; // 53366 Chimera Shot - Wyvern + //} + + // Refresh aura duration + aura->RefreshDuration(); + } + break; } - // Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute. - else if (familyFlag[0] & 0x00008000) - spellId = HUNTER_SPELL_CHIMERA_SHOT_SCORPID; - // ?? nothing say in spell desc (possibly need addition check) - //if (familyFlag & 0x0000010000000000LL || // dot - // familyFlag & 0x0000100000000000LL) // stun - //{ - // spellId = 53366; // 53366 Chimera Shot - Wyvern - //} - - // Refresh aura duration - aura->RefreshDuration(); + if (spellId) + caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, true); + if (spellId == HUNTER_SPELL_CHIMERA_SHOT_SCORPID && caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown + caster->ToPlayer()->AddSpellCooldown(spellId, 0, uint32(time(NULL) + 60)); } - break; } - if (spellId) - caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, true); - if (spellId == HUNTER_SPELL_CHIMERA_SHOT_SCORPID && caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown - caster->ToPlayer()->AddSpellCooldown(spellId, 0, uint32(time(NULL) + 60)); - } - void Register() + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_hun_chimera_shot_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_hun_chimera_shot_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + return new spell_hun_chimera_shot_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_hun_chimera_shot_SpellScript(); - } }; // 53412 Invigoration class spell_hun_invigoration : public SpellScriptLoader { -public: - spell_hun_invigoration() : SpellScriptLoader("spell_hun_invigoration") { } + public: + spell_hun_invigoration() : SpellScriptLoader("spell_hun_invigoration") { } - class spell_hun_invigoration_SpellScript : public SpellScript - { - PrepareSpellScript(spell_hun_invigoration_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) + class spell_hun_invigoration_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_INVIGORATION_TRIGGERED)) - return false; - return true; - } + PrepareSpellScript(spell_hun_invigoration_SpellScript); - void HandleScriptEffect(SpellEffIndex /*effIndex*/) - { - if (Unit* unitTarget = GetHitUnit()) - if (AuraEffect* aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_HUNTER, 3487, 0)) - if (roll_chance_i(aurEff->GetAmount())) - unitTarget->CastSpell(unitTarget, HUNTER_SPELL_INVIGORATION_TRIGGERED, true); - } + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_INVIGORATION_TRIGGERED)) + return false; + return true; + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + if (Unit* unitTarget = GetHitUnit()) + if (AuraEffect* aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_HUNTER, 3487, 0)) + if (roll_chance_i(aurEff->GetAmount())) + unitTarget->CastSpell(unitTarget, HUNTER_SPELL_INVIGORATION_TRIGGERED, true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_hun_invigoration_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - void Register() + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_hun_invigoration_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + return new spell_hun_invigoration_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_hun_invigoration_SpellScript(); - } }; class spell_hun_last_stand_pet : public SpellScriptLoader { -public: - spell_hun_last_stand_pet() : SpellScriptLoader("spell_hun_last_stand_pet") { } + public: + spell_hun_last_stand_pet() : SpellScriptLoader("spell_hun_last_stand_pet") { } - class spell_hun_last_stand_pet_SpellScript : public SpellScript - { - PrepareSpellScript(spell_hun_last_stand_pet_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) + class spell_hun_last_stand_pet_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED)) - return false; - return true; - } + PrepareSpellScript(spell_hun_last_stand_pet_SpellScript); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(30)); - caster->CastCustomSpell(caster, HUNTER_PET_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); - } + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(30)); + caster->CastCustomSpell(caster, HUNTER_PET_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); + } + + void Register() + { + // add dummy effect spell handler to pet's Last Stand + OnEffectHitTarget += SpellEffectFn(spell_hun_last_stand_pet_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - void Register() + SpellScript* GetSpellScript() const { - // add dummy effect spell handler to pet's Last Stand - OnEffectHitTarget += SpellEffectFn(spell_hun_last_stand_pet_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_hun_last_stand_pet_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_hun_last_stand_pet_SpellScript(); - } }; class spell_hun_masters_call : public SpellScriptLoader @@ -267,14 +262,11 @@ class spell_hun_masters_call : public SpellScriptLoader class spell_hun_masters_call_SpellScript : public SpellScript { - PrepareSpellScript(spell_hun_masters_call_SpellScript) + PrepareSpellScript(spell_hun_masters_call_SpellScript); + bool Validate(SpellInfo const* spellEntry) { - if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_MASTERS_CALL_TRIGGERED)) - return false; - if (!sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_0].CalcValue())) - return false; - if (!sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_1].CalcValue())) + if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_MASTERS_CALL_TRIGGERED) || !sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_0].CalcValue()) || !sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_1].CalcValue())) return false; return true; } @@ -312,80 +304,86 @@ class spell_hun_masters_call : public SpellScriptLoader class spell_hun_readiness : public SpellScriptLoader { -public: - spell_hun_readiness() : SpellScriptLoader("spell_hun_readiness") { } + public: + spell_hun_readiness() : SpellScriptLoader("spell_hun_readiness") { } - class spell_hun_readiness_SpellScript : public SpellScript - { - PrepareSpellScript(spell_hun_readiness_SpellScript) - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_hun_readiness_SpellScript : public SpellScript { - Unit* caster = GetCaster(); - if (caster->GetTypeId() != TYPEID_PLAYER) - return; - - // immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath - const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap(); - for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); - - ///! If spellId in cooldown map isn't valid, the above will return a null pointer. - if (spellInfo && - spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && - spellInfo->Id != HUNTER_SPELL_READINESS && - spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH && - spellInfo->GetRecoveryTime() > 0) - caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true); - else - ++itr; + PrepareSpellScript(spell_hun_readiness_SpellScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - } - void Register() + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + // immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath + const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap(); + for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); + + ///! If spellId in cooldown map isn't valid, the above will return a null pointer. + if (spellInfo && + spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && + spellInfo->Id != HUNTER_SPELL_READINESS && + spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH && + spellInfo->GetRecoveryTime() > 0) + caster->RemoveSpellCooldown((itr++)->first, true); + else + ++itr; + } + } + + void Register() + { + // add dummy effect spell handler to Readiness + OnEffectHitTarget += SpellEffectFn(spell_hun_readiness_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - // add dummy effect spell handler to Readiness - OnEffectHitTarget += SpellEffectFn(spell_hun_readiness_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_hun_readiness_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_hun_readiness_SpellScript(); - } }; // 37506 Scatter Shot class spell_hun_scatter_shot : public SpellScriptLoader { -public: - spell_hun_scatter_shot() : SpellScriptLoader("spell_hun_scatter_shot") { } + public: + spell_hun_scatter_shot() : SpellScriptLoader("spell_hun_scatter_shot") { } - class spell_hun_scatter_shot_SpellScript : public SpellScript - { - PrepareSpellScript(spell_hun_scatter_shot_SpellScript) - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_hun_scatter_shot_SpellScript : public SpellScript { - Unit* caster = GetCaster(); - if (caster->GetTypeId() != TYPEID_PLAYER) - return; - - // break Auto Shot and autohit - caster->InterruptSpell(CURRENT_AUTOREPEAT_SPELL); - caster->AttackStop(); - caster->ToPlayer()->SendAttackSwingCancelAttack(); - } + PrepareSpellScript(spell_hun_scatter_shot_SpellScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + // break Auto Shot and autohit + caster->InterruptSpell(CURRENT_AUTOREPEAT_SPELL); + caster->AttackStop(); + caster->SendAttackSwingCancelAttack(); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_hun_scatter_shot_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - void Register() + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_hun_scatter_shot_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_hun_scatter_shot_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_hun_scatter_shot_SpellScript(); - } }; // 53302, 53303, 53304 Sniper Training @@ -397,169 +395,164 @@ enum eSniperTrainingSpells class spell_hun_sniper_training : public SpellScriptLoader { -public: - spell_hun_sniper_training() : SpellScriptLoader("spell_hun_sniper_training") { } - - class spell_hun_sniper_training_AuraScript : public AuraScript - { - PrepareAuraScript(spell_hun_sniper_training_AuraScript) - bool Validate(SpellInfo const* /*entry*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_R1)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_BUFF_R1)) - return false; - return true; - } + public: + spell_hun_sniper_training() : SpellScriptLoader("spell_hun_sniper_training") { } - void HandlePeriodic(AuraEffect const* aurEff) + class spell_hun_sniper_training_AuraScript : public AuraScript { - PreventDefaultAction(); - if (aurEff->GetAmount() > 0) - return; + PrepareAuraScript(spell_hun_sniper_training_AuraScript); - Unit* caster = GetCaster(); + bool Validate(SpellInfo const* /*entry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_R1) || !sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_BUFF_R1)) + return false; + return true; + } - if (!caster) - return; + void HandlePeriodic(AuraEffect const* aurEff) + { + PreventDefaultAction(); + if (aurEff->GetAmount() <= 0) + { + Unit* caster = GetCaster(); + uint32 spellId = SPELL_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_SNIPER_TRAINING_R1; + if (Unit* target = GetTarget()) + if (!target->HasAura(spellId)) + { + SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(spellId); + Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? caster : target; + triggerCaster->CastSpell(target, triggeredSpellInfo, true, 0, aurEff); + } + } + } - uint32 spellId = SPELL_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_SNIPER_TRAINING_R1; - Unit* target = GetTarget(); - if (!target->HasAura(spellId)) + void HandleUpdatePeriodic(AuraEffect* aurEff) { - SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(spellId); - Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? caster : target; - triggerCaster->CastSpell(target, triggeredSpellInfo, true, 0, aurEff); + if (Player* playerTarget = GetUnitOwner()->ToPlayer()) + { + int32 baseAmount = aurEff->GetBaseAmount(); + int32 amount = playerTarget->isMoving() ? + playerTarget->CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount) : + aurEff->GetAmount() - 1; + aurEff->SetAmount(amount); + } } - } - void HandleUpdatePeriodic(AuraEffect* aurEff) - { - Unit* target = GetUnitOwner(); - if (Player* playerTarget = target->ToPlayer()) + void Register() { - int32 baseAmount = aurEff->GetBaseAmount(); - int32 amount = playerTarget->isMoving() ? - target->CalculateSpellDamage(target, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount) : - aurEff->GetAmount() - 1; - aurEff->SetAmount(amount); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_hun_sniper_training_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_hun_sniper_training_AuraScript::HandleUpdatePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } - } + }; - void Register() + AuraScript* GetAuraScript() const { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_hun_sniper_training_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_hun_sniper_training_AuraScript::HandleUpdatePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + return new spell_hun_sniper_training_AuraScript(); } - }; - - AuraScript* GetAuraScript() const - { - return new spell_hun_sniper_training_AuraScript(); - } }; class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader { -public: - spell_hun_pet_heart_of_the_phoenix() : SpellScriptLoader("spell_hun_pet_heart_of_the_phoenix") { } + public: + spell_hun_pet_heart_of_the_phoenix() : SpellScriptLoader("spell_hun_pet_heart_of_the_phoenix") { } - class spell_hun_pet_heart_of_the_phoenix_SpellScript : public SpellScript - { - PrepareSpellScript(spell_hun_pet_heart_of_the_phoenix_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) + class spell_hun_pet_heart_of_the_phoenix_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED)) - return false; - if (!sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) - return false; - return true; - } + PrepareSpellScript(spell_hun_pet_heart_of_the_phoenix_SpellScript); - void HandleScript(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - Unit* owner = caster->GetOwner(); - if (!owner || caster->HasAura(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) - return; - owner->CastCustomSpell(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, SPELLVALUE_BASE_POINT0, 100, caster, true); - caster->CastSpell(caster, HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF, true); - } + bool Load() + { + if (!GetCaster()->isPet()) + return false; + return true; + } - void Register() - { - // add dummy effect spell handler to pet's Last Stand - OnEffectHitTarget += SpellEffectFn(spell_hun_pet_heart_of_the_phoenix_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); - } + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED) || !sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Unit* owner = caster->GetOwner()) + if (!caster->HasAura(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) + { + owner->CastCustomSpell(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, SPELLVALUE_BASE_POINT0, 100, caster, true); + caster->CastSpell(caster, HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF, true); + } + } - bool Load() + void Register() + { + // add dummy effect spell handler to pet's Last Stand + OnEffectHitTarget += SpellEffectFn(spell_hun_pet_heart_of_the_phoenix_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const { - if (!GetCaster()->isPet()) - return false; - return true; + return new spell_hun_pet_heart_of_the_phoenix_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_hun_pet_heart_of_the_phoenix_SpellScript(); - } }; class spell_hun_pet_carrion_feeder : public SpellScriptLoader { -public: - spell_hun_pet_carrion_feeder() : SpellScriptLoader("spell_hun_pet_carrion_feeder") { } + public: + spell_hun_pet_carrion_feeder() : SpellScriptLoader("spell_hun_pet_carrion_feeder") { } - class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript - { - PrepareSpellScript(spell_hun_pet_carrion_feeder_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) + class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED)) - return false; - return true; - } + PrepareSpellScript(spell_hun_pet_carrion_feeder_SpellScript); + + bool Load() + { + if (!GetCaster()->isPet()) + return false; + return true; + } - SpellCastResult CheckIfCorpseNear() - { - Unit* caster = GetCaster(); - float max_range = GetSpellInfo()->GetMaxRange(false); - WorldObject* result = NULL; - // search for nearby enemy corpse in range - Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_SELECT_CHECK_ENEMY); - Trinity::WorldObjectSearcher searcher(caster, result, check); - caster->GetMap()->VisitFirstFound(caster->m_positionX, caster->m_positionY, max_range, searcher); - if (!result) - return SPELL_FAILED_NO_EDIBLE_CORPSES; - return SPELL_CAST_OK; - } + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED)) + return false; + return true; + } - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - caster->CastSpell(caster, HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED, false); - } + SpellCastResult CheckIfCorpseNear() + { + Unit* caster = GetCaster(); + float max_range = GetSpellInfo()->GetMaxRange(false); + WorldObject* result = NULL; + // search for nearby enemy corpse in range + Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_SELECT_CHECK_ENEMY); + Trinity::WorldObjectSearcher searcher(caster, result, check); + caster->GetMap()->VisitFirstFound(caster->m_positionX, caster->m_positionY, max_range, searcher); + if (!result) + return SPELL_FAILED_NO_EDIBLE_CORPSES; + return SPELL_CAST_OK; + } - void Register() - { - // add dummy effect spell handler to pet's Last Stand - OnEffectHit += SpellEffectFn(spell_hun_pet_carrion_feeder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - OnCheckCast += SpellCheckCastFn(spell_hun_pet_carrion_feeder_SpellScript::CheckIfCorpseNear); - } + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + caster->CastSpell(caster, HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED, false); + } - bool Load() + void Register() + { + // add dummy effect spell handler to pet's Last Stand + OnEffectHit += SpellEffectFn(spell_hun_pet_carrion_feeder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnCheckCast += SpellCheckCastFn(spell_hun_pet_carrion_feeder_SpellScript::CheckIfCorpseNear); + } + }; + + SpellScript* GetSpellScript() const { - if (!GetCaster()->isPet()) - return false; - return true; + return new spell_hun_pet_carrion_feeder_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_hun_pet_carrion_feeder_SpellScript(); - } }; void AddSC_hunter_spell_scripts() diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index b40879d500e..844162a88ec 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -21,55 +21,55 @@ * Scriptnames of files in this file should be prefixed with "spell_item_". */ -#include "ScriptPCH.h" #include "SkillDiscovery.h" // Generic script for handling item dummy effects which trigger another spell. class spell_item_trigger_spell : public SpellScriptLoader { -private: - uint32 _triggeredSpellId; - -public: - spell_item_trigger_spell(const char* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { } - - class spell_item_trigger_spell_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_trigger_spell_SpellScript) private: uint32 _triggeredSpellId; public: - spell_item_trigger_spell_SpellScript(uint32 triggeredSpellId) : SpellScript(), _triggeredSpellId(triggeredSpellId) { } + spell_item_trigger_spell(const char* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { } - bool Validate(SpellInfo const* /*spellEntry*/) + class spell_item_trigger_spell_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(_triggeredSpellId)) - return false; - return true; - } + PrepareSpellScript(spell_item_trigger_spell_SpellScript); + private: + uint32 _triggeredSpellId; - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Item* pItem = GetCastItem()) - GetCaster()->CastSpell(GetCaster(), _triggeredSpellId, true, pItem); - } + public: + spell_item_trigger_spell_SpellScript(uint32 triggeredSpellId) : SpellScript(), _triggeredSpellId(triggeredSpellId) { } - void Register() + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(_triggeredSpellId)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Item* pItem = GetCastItem()) + caster->CastSpell(caster, _triggeredSpellId, true, pItem); + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_item_trigger_spell_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHit += SpellEffectFn(spell_item_trigger_spell_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_item_trigger_spell_SpellScript(_triggeredSpellId); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_item_trigger_spell_SpellScript(_triggeredSpellId); - } }; // http://www.wowhead.com/item=6522 Deviate Fish // 8063 Deviate Fish -enum eDeviateFishSpells +enum DeviateFishSpells { SPELL_SLEEPY = 8064, SPELL_INVIGORATE = 8065, @@ -80,46 +80,48 @@ enum eDeviateFishSpells class spell_item_deviate_fish : public SpellScriptLoader { -public: - spell_item_deviate_fish() : SpellScriptLoader("spell_item_deviate_fish") { } - - class spell_item_deviate_fish_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_deviate_fish_SpellScript) public: - bool Validate(SpellInfo const* /*spellEntry*/) - { - for (uint32 spellId = SPELL_SLEEPY; spellId <= SPELL_HEALTHY_SPIRIT; ++spellId) - if (!sSpellMgr->GetSpellInfo(spellId)) - return false; - return true; - } + spell_item_deviate_fish() : SpellScriptLoader("spell_item_deviate_fish") { } - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_item_deviate_fish_SpellScript : public SpellScript { - Unit* pCaster = GetCaster(); - if (pCaster->GetTypeId() != TYPEID_PLAYER) - return; + PrepareSpellScript(spell_item_deviate_fish_SpellScript); - uint32 spellId = urand(SPELL_SLEEPY, SPELL_HEALTHY_SPIRIT); - pCaster->CastSpell(pCaster, spellId, true, NULL); - } + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - void Register() + bool Validate(SpellInfo const* /*spellEntry*/) + { + for (uint32 spellId = SPELL_SLEEPY; spellId <= SPELL_HEALTHY_SPIRIT; ++spellId) + if (!sSpellMgr->GetSpellInfo(spellId)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + uint32 spellId = urand(SPELL_SLEEPY, SPELL_HEALTHY_SPIRIT); + caster->CastSpell(caster, spellId, true, NULL); + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_item_deviate_fish_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHit += SpellEffectFn(spell_item_deviate_fish_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_item_deviate_fish_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_item_deviate_fish_SpellScript(); - } }; // http://www.wowhead.com/item=47499 Flask of the North // 67019 Flask of the North -enum eFlaskOfTheNorthSpells +enum FlaskOfTheNorthSpells { SPELL_FLASK_OF_THE_NORTH_SP = 67016, SPELL_FLASK_OF_THE_NORTH_AP = 67017, @@ -128,75 +130,68 @@ enum eFlaskOfTheNorthSpells class spell_item_flask_of_the_north : public SpellScriptLoader { -public: - spell_item_flask_of_the_north() : SpellScriptLoader("spell_item_flask_of_the_north") { } - - class spell_item_flask_of_the_north_SpellScript : public SpellScript - { public: - PrepareSpellScript(spell_item_flask_of_the_north_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_FLASK_OF_THE_NORTH_SP)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_FLASK_OF_THE_NORTH_AP)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_FLASK_OF_THE_NORTH_STR)) - return false; - return true; - } + spell_item_flask_of_the_north() : SpellScriptLoader("spell_item_flask_of_the_north") { } - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_item_flask_of_the_north_SpellScript : public SpellScript { - Unit* pCaster = GetCaster(); - if (pCaster->GetTypeId() != TYPEID_PLAYER) - return; + PrepareSpellScript(spell_item_flask_of_the_north_SpellScript); - std::vector possibleSpells; - switch (pCaster->getClass()) + bool Validate(SpellInfo const* /*spellEntry*/) { - case CLASS_WARLOCK: - case CLASS_MAGE: - case CLASS_PRIEST: - possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_SP); - break; - case CLASS_DEATH_KNIGHT: - case CLASS_WARRIOR: - possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_STR); - break; - case CLASS_ROGUE: - case CLASS_HUNTER: - possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_AP); - break; - case CLASS_DRUID: - case CLASS_PALADIN: - possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_SP); - possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_STR); - break; - case CLASS_SHAMAN: - possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_SP); - possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_AP); - break; + if (!sSpellMgr->GetSpellInfo(SPELL_FLASK_OF_THE_NORTH_SP) || !sSpellMgr->GetSpellInfo(SPELL_FLASK_OF_THE_NORTH_AP) || !sSpellMgr->GetSpellInfo(SPELL_FLASK_OF_THE_NORTH_STR)) + return false; + return true; } - pCaster->CastSpell(pCaster, possibleSpells[irand(0, (possibleSpells.size() - 1))], true, NULL); - } + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + std::vector possibleSpells; + switch (caster->getClass()) + { + case CLASS_WARLOCK: + case CLASS_MAGE: + case CLASS_PRIEST: + possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_SP); + break; + case CLASS_DEATH_KNIGHT: + case CLASS_WARRIOR: + possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_STR); + break; + case CLASS_ROGUE: + case CLASS_HUNTER: + possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_AP); + break; + case CLASS_DRUID: + case CLASS_PALADIN: + possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_SP); + possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_STR); + break; + case CLASS_SHAMAN: + possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_SP); + possibleSpells.push_back(SPELL_FLASK_OF_THE_NORTH_AP); + break; + } - void Register() + caster->CastSpell(caster, possibleSpells[irand(0, (possibleSpells.size() - 1))], true, NULL); + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_item_flask_of_the_north_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHit += SpellEffectFn(spell_item_flask_of_the_north_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_item_flask_of_the_north_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_item_flask_of_the_north_SpellScript(); - } }; // http://www.wowhead.com/item=10645 Gnomish Death Ray // 13280 Gnomish Death Ray -enum eGnomishDeathRay +enum GnomishDeathRay { SPELL_GNOMISH_DEATH_RAY_SELF = 13493, SPELL_GNOMISH_DEATH_RAY_TARGET = 13279, @@ -204,49 +199,45 @@ enum eGnomishDeathRay class spell_item_gnomish_death_ray : public SpellScriptLoader { -public: - spell_item_gnomish_death_ray() : SpellScriptLoader("spell_item_gnomish_death_ray") { } - - class spell_item_gnomish_death_ray_SpellScript : public SpellScript - { public: - PrepareSpellScript(spell_item_gnomish_death_ray_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_GNOMISH_DEATH_RAY_SELF)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_GNOMISH_DEATH_RAY_TARGET)) - return false; - return true; - } + spell_item_gnomish_death_ray() : SpellScriptLoader("spell_item_gnomish_death_ray") { } - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_item_gnomish_death_ray_SpellScript : public SpellScript { - if (Unit* target = GetHitUnit()) + PrepareSpellScript(spell_item_gnomish_death_ray_SpellScript); + + bool Validate(SpellInfo const* /*spellEntry*/) { - Unit* pCaster = GetCaster(); - if (urand(0, 99) < 15) - pCaster->CastSpell(pCaster, SPELL_GNOMISH_DEATH_RAY_SELF, true, NULL); // failure - else - pCaster->CastSpell(target, SPELL_GNOMISH_DEATH_RAY_TARGET, true, NULL); + if (!sSpellMgr->GetSpellInfo(SPELL_GNOMISH_DEATH_RAY_SELF) || !sSpellMgr->GetSpellInfo(SPELL_GNOMISH_DEATH_RAY_TARGET)) + return false; + return true; } - } - void Register() + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) + if (urand(0, 99) < 15) + caster->CastSpell(caster, SPELL_GNOMISH_DEATH_RAY_SELF, true, NULL); // failure + else + caster->CastSpell(target, SPELL_GNOMISH_DEATH_RAY_TARGET, true, NULL); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_gnomish_death_ray_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_item_gnomish_death_ray_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_item_gnomish_death_ray_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_item_gnomish_death_ray_SpellScript(); - } }; // http://www.wowhead.com/item=27388 Mr. Pinchy // 33060 Make a Wish -enum eMakeAWish +enum MakeAWish { SPELL_MR_PINCHYS_BLESSING = 33053, SPELL_SUMMON_MIGHTY_MR_PINCHY = 33057, @@ -257,115 +248,110 @@ enum eMakeAWish class spell_item_make_a_wish : public SpellScriptLoader { -public: - spell_item_make_a_wish() : SpellScriptLoader("spell_item_make_a_wish") { } - - class spell_item_make_a_wish_SpellScript : public SpellScript - { public: - PrepareSpellScript(spell_item_make_a_wish_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_MR_PINCHYS_BLESSING)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_MIGHTY_MR_PINCHY)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_FURIOUS_MR_PINCHY)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_TINY_MAGICAL_CRAWDAD)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_MR_PINCHYS_GIFT)) - return false; - return true; - } + spell_item_make_a_wish() : SpellScriptLoader("spell_item_make_a_wish") { } - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_item_make_a_wish_SpellScript : public SpellScript { - Unit* pCaster = GetCaster(); - if (pCaster->GetTypeId() != TYPEID_PLAYER) - return; + PrepareSpellScript(spell_item_make_a_wish_SpellScript); - uint32 spellId = SPELL_MR_PINCHYS_GIFT; - switch (urand(1, 5)) + bool Load() { - case 1: spellId = SPELL_MR_PINCHYS_BLESSING; break; - case 2: spellId = SPELL_SUMMON_MIGHTY_MR_PINCHY; break; - case 3: spellId = SPELL_SUMMON_FURIOUS_MR_PINCHY; break; - case 4: spellId = SPELL_TINY_MAGICAL_CRAWDAD; break; + return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - pCaster->CastSpell(pCaster, spellId, true, NULL); - } - void Register() + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_MR_PINCHYS_BLESSING) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_MIGHTY_MR_PINCHY) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_FURIOUS_MR_PINCHY) || !sSpellMgr->GetSpellInfo(SPELL_TINY_MAGICAL_CRAWDAD) || !sSpellMgr->GetSpellInfo(SPELL_MR_PINCHYS_GIFT)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + uint32 spellId = SPELL_MR_PINCHYS_GIFT; + switch (urand(1, 5)) + { + case 1: spellId = SPELL_MR_PINCHYS_BLESSING; break; + case 2: spellId = SPELL_SUMMON_MIGHTY_MR_PINCHY; break; + case 3: spellId = SPELL_SUMMON_FURIOUS_MR_PINCHY; break; + case 4: spellId = SPELL_TINY_MAGICAL_CRAWDAD; break; + } + caster->CastSpell(caster, spellId, true, NULL); + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_item_make_a_wish_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHit += SpellEffectFn(spell_item_make_a_wish_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_item_make_a_wish_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_item_make_a_wish_SpellScript(); - } }; // http://www.wowhead.com/item=32686 Mingo's Fortune Giblets // 40802 Mingo's Fortune Generator class spell_item_mingos_fortune_generator : public SpellScriptLoader { -public: - spell_item_mingos_fortune_generator() : SpellScriptLoader("spell_item_mingos_fortune_generator") { } + public: + spell_item_mingos_fortune_generator() : SpellScriptLoader("spell_item_mingos_fortune_generator") { } - class spell_item_mingos_fortune_generator_SpellScript : public SpellScript - { - PrepareSpellScript(spell_item_mingos_fortune_generator_SpellScript) - void HandleDummy(SpellEffIndex effIndex) - { - // Selecting one from Bloodstained Fortune item - uint32 newitemid; - switch (urand(1, 20)) - { - case 1: newitemid = 32688; break; - case 2: newitemid = 32689; break; - case 3: newitemid = 32690; break; - case 4: newitemid = 32691; break; - case 5: newitemid = 32692; break; - case 6: newitemid = 32693; break; - case 7: newitemid = 32700; break; - case 8: newitemid = 32701; break; - case 9: newitemid = 32702; break; - case 10: newitemid = 32703; break; - case 11: newitemid = 32704; break; - case 12: newitemid = 32705; break; - case 13: newitemid = 32706; break; - case 14: newitemid = 32707; break; - case 15: newitemid = 32708; break; - case 16: newitemid = 32709; break; - case 17: newitemid = 32710; break; - case 18: newitemid = 32711; break; - case 19: newitemid = 32712; break; - case 20: newitemid = 32713; break; - default: - return; + class spell_item_mingos_fortune_generator_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_mingos_fortune_generator_SpellScript); + + void HandleDummy(SpellEffIndex effIndex) + { + // Selecting one from Bloodstained Fortune item + uint32 newitemid; + switch (urand(1, 20)) + { + case 1: newitemid = 32688; break; + case 2: newitemid = 32689; break; + case 3: newitemid = 32690; break; + case 4: newitemid = 32691; break; + case 5: newitemid = 32692; break; + case 6: newitemid = 32693; break; + case 7: newitemid = 32700; break; + case 8: newitemid = 32701; break; + case 9: newitemid = 32702; break; + case 10: newitemid = 32703; break; + case 11: newitemid = 32704; break; + case 12: newitemid = 32705; break; + case 13: newitemid = 32706; break; + case 14: newitemid = 32707; break; + case 15: newitemid = 32708; break; + case 16: newitemid = 32709; break; + case 17: newitemid = 32710; break; + case 18: newitemid = 32711; break; + case 19: newitemid = 32712; break; + case 20: newitemid = 32713; break; + default: + return; + } + + CreateItem(effIndex, newitemid); } - CreateItem(effIndex, newitemid); - } + void Register() + { + OnEffectHit += SpellEffectFn(spell_item_mingos_fortune_generator_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - void Register() + SpellScript* GetSpellScript() const { - OnEffectHit += SpellEffectFn(spell_item_mingos_fortune_generator_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_item_mingos_fortune_generator_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_item_mingos_fortune_generator_SpellScript(); - } }; // http://www.wowhead.com/item=10720 Gnomish Net-o-Matic Projector // 13120 Net-o-Matic -enum eNetOMaticSpells +enum NetOMaticSpells { SPELL_NET_O_MATIC_TRIGGERED1 = 16566, SPELL_NET_O_MATIC_TRIGGERED2 = 13119, @@ -374,54 +360,50 @@ enum eNetOMaticSpells class spell_item_net_o_matic : public SpellScriptLoader { -public: - spell_item_net_o_matic() : SpellScriptLoader("spell_item_net_o_matic") { } - - class spell_item_net_o_matic_SpellScript : public SpellScript - { public: - PrepareSpellScript(spell_item_net_o_matic_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_NET_O_MATIC_TRIGGERED1)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_NET_O_MATIC_TRIGGERED2)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_NET_O_MATIC_TRIGGERED3)) - return false; - return true; - } + spell_item_net_o_matic() : SpellScriptLoader("spell_item_net_o_matic") { } - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_item_net_o_matic_SpellScript : public SpellScript { - if (Unit* target = GetHitUnit()) + PrepareSpellScript(spell_item_net_o_matic_SpellScript); + + bool Validate(SpellInfo const* /*spellEntry*/) { - uint32 spellId = SPELL_NET_O_MATIC_TRIGGERED3; - uint32 roll = urand(0, 99); - if (roll < 2) // 2% for 30 sec self root (off-like chance unknown) - spellId = SPELL_NET_O_MATIC_TRIGGERED1; - else if (roll < 4) // 2% for 20 sec root, charge to target (off-like chance unknown) - spellId = SPELL_NET_O_MATIC_TRIGGERED2; + if (!sSpellMgr->GetSpellInfo(SPELL_NET_O_MATIC_TRIGGERED1) || !sSpellMgr->GetSpellInfo(SPELL_NET_O_MATIC_TRIGGERED2) || !sSpellMgr->GetSpellInfo(SPELL_NET_O_MATIC_TRIGGERED3)) + return false; + return true; + } - GetCaster()->CastSpell(target, spellId, true, NULL); + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + { + uint32 spellId = SPELL_NET_O_MATIC_TRIGGERED3; + uint32 roll = urand(0, 99); + if (roll < 2) // 2% for 30 sec self root (off-like chance unknown) + spellId = SPELL_NET_O_MATIC_TRIGGERED1; + else if (roll < 4) // 2% for 20 sec root, charge to target (off-like chance unknown) + spellId = SPELL_NET_O_MATIC_TRIGGERED2; + + GetCaster()->CastSpell(target, spellId, true, NULL); + } } - } - void Register() + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_net_o_matic_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_item_net_o_matic_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_item_net_o_matic_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_item_net_o_matic_SpellScript(); - } }; // http://www.wowhead.com/item=8529 Noggenfogger Elixir // 16589 Noggenfogger Elixir -enum eNoggenfoggerElixirSpells +enum NoggenfoggerElixirSpells { SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED1 = 16595, SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2 = 16593, @@ -430,55 +412,53 @@ enum eNoggenfoggerElixirSpells class spell_item_noggenfogger_elixir : public SpellScriptLoader { -public: - spell_item_noggenfogger_elixir() : SpellScriptLoader("spell_item_noggenfogger_elixir") { } - - class spell_item_noggenfogger_elixir_SpellScript : public SpellScript - { public: - PrepareSpellScript(spell_item_noggenfogger_elixir_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED1)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED3)) - return false; - return true; - } + spell_item_noggenfogger_elixir() : SpellScriptLoader("spell_item_noggenfogger_elixir") { } - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_item_noggenfogger_elixir_SpellScript : public SpellScript { - Unit* pCaster = GetCaster(); - if (pCaster->GetTypeId() != TYPEID_PLAYER) - return; + PrepareSpellScript(spell_item_noggenfogger_elixir_SpellScript); - uint32 spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED3; - switch (urand(1, 3)) + bool Load() { - case 1: spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED1; break; - case 2: spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2; break; + return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - pCaster->CastSpell(pCaster, spellId, true, NULL); - } - - void Register() - { - OnEffectHit += SpellEffectFn(spell_item_noggenfogger_elixir_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED1) || !sSpellMgr->GetSpellInfo(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2) || !sSpellMgr->GetSpellInfo(SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED3)) + return false; + return true; + } - SpellScript* GetSpellScript() const - { - return new spell_item_noggenfogger_elixir_SpellScript(); - } + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + uint32 spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED3; + switch (urand(1, 3)) + { + case 1: spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED1; break; + case 2: spellId = SPELL_NOGGENFOGGER_ELIXIR_TRIGGERED2; break; + } + + caster->CastSpell(caster, spellId, true, NULL); + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_item_noggenfogger_elixir_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_noggenfogger_elixir_SpellScript(); + } }; // http://www.wowhead.com/item=6657 Savory Deviate Delight // 8213 Savory Deviate Delight -enum eSavoryDeviateDelight +enum SavoryDeviateDelight { SPELL_FLIP_OUT_MALE = 8219, SPELL_FLIP_OUT_FEMALE = 8220, @@ -488,53 +468,55 @@ enum eSavoryDeviateDelight class spell_item_savory_deviate_delight : public SpellScriptLoader { -public: - spell_item_savory_deviate_delight() : SpellScriptLoader("spell_item_savory_deviate_delight") { } - - class spell_item_savory_deviate_delight_SpellScript : public SpellScript - { public: - PrepareSpellScript(spell_item_savory_deviate_delight_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) - { - for (uint32 spellId = SPELL_FLIP_OUT_MALE; spellId <= SPELL_YAAARRRR_FEMALE; ++spellId) - if (!sSpellMgr->GetSpellInfo(spellId)) - return false; - return true; - } + spell_item_savory_deviate_delight() : SpellScriptLoader("spell_item_savory_deviate_delight") { } - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_item_savory_deviate_delight_SpellScript : public SpellScript { - Unit* pCaster = GetCaster(); - if (pCaster->GetTypeId() != TYPEID_PLAYER) - return; + PrepareSpellScript(spell_item_savory_deviate_delight_SpellScript); - uint32 spellId = 0; - switch (urand(1, 2)) + bool Load() { - // Flip Out - ninja - case 1: spellId = (pCaster->getGender() == GENDER_MALE ? SPELL_FLIP_OUT_MALE : SPELL_FLIP_OUT_FEMALE); break; - // Yaaarrrr - pirate - case 2: spellId = (pCaster->getGender() == GENDER_MALE ? SPELL_YAAARRRR_MALE : SPELL_YAAARRRR_FEMALE); break; + return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - pCaster->CastSpell(pCaster, spellId, true, NULL); - } - void Register() + bool Validate(SpellInfo const* /*spellEntry*/) + { + for (uint32 spellId = SPELL_FLIP_OUT_MALE; spellId <= SPELL_YAAARRRR_FEMALE; ++spellId) + if (!sSpellMgr->GetSpellInfo(spellId)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + uint32 spellId = 0; + switch (urand(1, 2)) + { + // Flip Out - ninja + case 1: spellId = (caster->getGender() == GENDER_MALE ? SPELL_FLIP_OUT_MALE : SPELL_FLIP_OUT_FEMALE); break; + // Yaaarrrr - pirate + case 2: spellId = (caster->getGender() == GENDER_MALE ? SPELL_YAAARRRR_MALE : SPELL_YAAARRRR_FEMALE); break; + } + caster->CastSpell(caster, spellId, true, NULL); + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_item_savory_deviate_delight_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHit += SpellEffectFn(spell_item_savory_deviate_delight_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_item_savory_deviate_delight_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_item_savory_deviate_delight_SpellScript(); - } }; // http://www.wowhead.com/item=7734 Six Demon Bag // 14537 Six Demon Bag -enum eSixDemonBagSpells +enum SixDemonBagSpells { SPELL_FROSTBOLT = 11538, SPELL_POLYMORPH = 14621, @@ -546,77 +528,66 @@ enum eSixDemonBagSpells class spell_item_six_demon_bag : public SpellScriptLoader { -public: - spell_item_six_demon_bag() : SpellScriptLoader("spell_item_six_demon_bag") { } - - class spell_item_six_demon_bag_SpellScript : public SpellScript - { public: - PrepareSpellScript(spell_item_six_demon_bag_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_FROSTBOLT)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_POLYMORPH)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_FELHOUND_MINION)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_FIREBALL)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_CHAIN_LIGHTNING)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_ENVELOPING_WINDS)) - return false; - return true; - } + spell_item_six_demon_bag() : SpellScriptLoader("spell_item_six_demon_bag") { } - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_item_six_demon_bag_SpellScript : public SpellScript { - if (Unit* target = GetHitUnit()) + PrepareSpellScript(spell_item_six_demon_bag_SpellScript); + + bool Validate(SpellInfo const* /*spellEntry*/) { - Unit* pCaster = GetCaster(); + if (!sSpellMgr->GetSpellInfo(SPELL_FROSTBOLT) || !sSpellMgr->GetSpellInfo(SPELL_POLYMORPH) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_FELHOUND_MINION) || !sSpellMgr->GetSpellInfo(SPELL_FIREBALL) || !sSpellMgr->GetSpellInfo(SPELL_CHAIN_LIGHTNING) || !sSpellMgr->GetSpellInfo(SPELL_ENVELOPING_WINDS)) + return false; + return true; + } - uint32 spellId = 0; - uint32 rand = urand(0, 99); - if (rand < 25) // Fireball (25% chance) - spellId = SPELL_FIREBALL; - else if (rand < 50) // Frostball (25% chance) - spellId = SPELL_FROSTBOLT; - else if (rand < 70) // Chain Lighting (20% chance) - spellId = SPELL_CHAIN_LIGHTNING; - else if (rand < 80) // Polymorph (10% chance) - { - spellId = SPELL_POLYMORPH; - if (urand(0, 100) <= 30) // 30% chance to self-cast - target = pCaster; - } - else if (rand < 95) // Enveloping Winds (15% chance) - spellId = SPELL_ENVELOPING_WINDS; - else // Summon Felhund minion (5% chance) + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) { - spellId = SPELL_SUMMON_FELHOUND_MINION; - target = pCaster; + uint32 spellId = 0; + uint32 rand = urand(0, 99); + if (rand < 25) // Fireball (25% chance) + spellId = SPELL_FIREBALL; + else if (rand < 50) // Frostball (25% chance) + spellId = SPELL_FROSTBOLT; + else if (rand < 70) // Chain Lighting (20% chance) + spellId = SPELL_CHAIN_LIGHTNING; + else if (rand < 80) // Polymorph (10% chance) + { + spellId = SPELL_POLYMORPH; + if (urand(0, 100) <= 30) // 30% chance to self-cast + target = caster; + } + else if (rand < 95) // Enveloping Winds (15% chance) + spellId = SPELL_ENVELOPING_WINDS; + else // Summon Felhund minion (5% chance) + { + spellId = SPELL_SUMMON_FELHOUND_MINION; + target = caster; + } + + caster->CastSpell(target, spellId, true, GetCastItem()); } + } - pCaster->CastSpell(target, spellId, true, GetCastItem()); + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_six_demon_bag_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - } + }; - void Register() + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_item_six_demon_bag_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_item_six_demon_bag_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_item_six_demon_bag_SpellScript(); - } }; // http://www.wowhead.com/item=44012 Underbelly Elixir // 59640 Underbelly Elixir -enum eUnderbellyElixirSpells +enum UnderbellyElixirSpells { SPELL_UNDERBELLY_ELIXIR_TRIGGERED1 = 59645, SPELL_UNDERBELLY_ELIXIR_TRIGGERED2 = 59831, @@ -625,49 +596,46 @@ enum eUnderbellyElixirSpells class spell_item_underbelly_elixir : public SpellScriptLoader { -public: - spell_item_underbelly_elixir() : SpellScriptLoader("spell_item_underbelly_elixir") { } - - class spell_item_underbelly_elixir_SpellScript : public SpellScript - { public: - PrepareSpellScript(spell_item_underbelly_elixir_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_UNDERBELLY_ELIXIR_TRIGGERED1)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_UNDERBELLY_ELIXIR_TRIGGERED2)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_UNDERBELLY_ELIXIR_TRIGGERED3)) - return false; - return true; - } + spell_item_underbelly_elixir() : SpellScriptLoader("spell_item_underbelly_elixir") { } - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_item_underbelly_elixir_SpellScript : public SpellScript { - Unit* pCaster = GetCaster(); - if (pCaster->GetTypeId() != TYPEID_PLAYER) - return; + PrepareSpellScript(spell_item_underbelly_elixir_SpellScript); - uint32 spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED3; - switch (urand(1, 3)) + bool Load() { - case 1: spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED1; break; - case 2: spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED2; break; + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_UNDERBELLY_ELIXIR_TRIGGERED1) || !sSpellMgr->GetSpellInfo(SPELL_UNDERBELLY_ELIXIR_TRIGGERED2) || !sSpellMgr->GetSpellInfo(SPELL_UNDERBELLY_ELIXIR_TRIGGERED3)) + return false; + return true; } - pCaster->CastSpell(pCaster, spellId, true, NULL); - } - void Register() + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + uint32 spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED3; + switch (urand(1, 3)) + { + case 1: spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED1; break; + case 2: spellId = SPELL_UNDERBELLY_ELIXIR_TRIGGERED2; break; + } + caster->CastSpell(caster, spellId, true, NULL); + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_item_underbelly_elixir_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHit += SpellEffectFn(spell_item_underbelly_elixir_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_item_underbelly_elixir_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_item_underbelly_elixir_SpellScript(); - } }; enum eShadowmourneVisuals @@ -684,17 +652,11 @@ public: class spell_item_shadowmourne_AuraScript : public AuraScript { - public: - PrepareAuraScript(spell_item_shadowmourne_AuraScript) - spell_item_shadowmourne_AuraScript() : AuraScript() { } + PrepareAuraScript(spell_item_shadowmourne_AuraScript); bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_VISUAL_LOW)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_VISUAL_HIGH)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF)) + if (!sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_VISUAL_LOW) || !sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_VISUAL_HIGH) || !sSpellMgr->GetSpellInfo(SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF)) return false; return true; } @@ -702,7 +664,6 @@ public: void OnStackChange(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - switch (GetStackAmount()) { case 1: @@ -716,6 +677,8 @@ public: target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_HIGH); target->CastSpell(target, SPELL_SHADOWMOURNE_CHAOS_BANE_BUFF, true); break; + default: + break; } } @@ -739,392 +702,1245 @@ public: } }; -enum AirRifleSpells +enum AirRifleSpells +{ + SPELL_AIR_RIFLE_HOLD_VISUAL = 65582, + SPELL_AIR_RIFLE_SHOOT = 67532, + SPELL_AIR_RIFLE_SHOOT_SELF = 65577, +}; + +class spell_item_red_rider_air_rifle : public SpellScriptLoader +{ + public: + spell_item_red_rider_air_rifle() : SpellScriptLoader("spell_item_red_rider_air_rifle") { } + + class spell_item_red_rider_air_rifle_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_red_rider_air_rifle_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_AIR_RIFLE_HOLD_VISUAL) || !sSpellMgr->GetSpellInfo(SPELL_AIR_RIFLE_SHOOT) || !sSpellMgr->GetSpellInfo(SPELL_AIR_RIFLE_SHOOT_SELF)) + return false; + return true; + } + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) + { + caster->CastSpell(caster, SPELL_AIR_RIFLE_HOLD_VISUAL, true); + // needed because this spell shares GCD with its triggered spells (which must not be cast with triggered flag) + if (Player* player = caster->ToPlayer()) + player->GetGlobalCooldownMgr().CancelGlobalCooldown(GetSpellInfo()); + if (urand(0, 4)) + caster->CastSpell(target, SPELL_AIR_RIFLE_SHOOT, false); + else + caster->CastSpell(caster, SPELL_AIR_RIFLE_SHOOT_SELF, false); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_red_rider_air_rifle_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_red_rider_air_rifle_SpellScript(); + } +}; + +enum GenericData +{ + SPELL_ARCANITE_DRAGONLING = 19804, + SPELL_BATTLE_CHICKEN = 13166, + SPELL_MECHANICAL_DRAGONLING = 4073, + SPELL_MITHRIL_MECHANICAL_DRAGONLING = 12749, +}; + +enum CreateHeartCandy +{ + ITEM_HEART_CANDY_1 = 21818, + ITEM_HEART_CANDY_2 = 21817, + ITEM_HEART_CANDY_3 = 21821, + ITEM_HEART_CANDY_4 = 21819, + ITEM_HEART_CANDY_5 = 21816, + ITEM_HEART_CANDY_6 = 21823, + ITEM_HEART_CANDY_7 = 21822, + ITEM_HEART_CANDY_8 = 21820, +}; + +class spell_item_create_heart_candy : public SpellScriptLoader +{ + public: + spell_item_create_heart_candy() : SpellScriptLoader("spell_item_create_heart_candy") { } + + class spell_item_create_heart_candy_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_create_heart_candy_SpellScript); + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Player* target = GetHitPlayer()) + { + static const uint32 items[] = {ITEM_HEART_CANDY_1, ITEM_HEART_CANDY_2, ITEM_HEART_CANDY_3, ITEM_HEART_CANDY_4, ITEM_HEART_CANDY_5, ITEM_HEART_CANDY_6, ITEM_HEART_CANDY_7, ITEM_HEART_CANDY_8}; + target->AddItem(items[urand(0, 7)], 1); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_create_heart_candy_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_create_heart_candy_SpellScript(); + } +}; + +class spell_item_book_of_glyph_mastery : public SpellScriptLoader +{ + public: + spell_item_book_of_glyph_mastery() : SpellScriptLoader("spell_item_book_of_glyph_mastery") {} + + class spell_item_book_of_glyph_mastery_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_book_of_glyph_mastery_SpellScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + SpellCastResult CheckRequirement() + { + if (HasDiscoveredAllSpells(GetSpellInfo()->Id, GetCaster()->ToPlayer())) + { + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_LEARNED_EVERYTHING); + return SPELL_FAILED_CUSTOM_ERROR; + } + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_item_book_of_glyph_mastery_SpellScript::CheckRequirement); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_book_of_glyph_mastery_SpellScript(); + } +}; + +enum GiftOfTheHarvester +{ + NPC_GHOUL = 28845, + MAX_GHOULS = 5, +}; + +class spell_item_gift_of_the_harvester : public SpellScriptLoader +{ + public: + spell_item_gift_of_the_harvester() : SpellScriptLoader("spell_item_gift_of_the_harvester") {} + + class spell_item_gift_of_the_harvester_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_gift_of_the_harvester_SpellScript); + + SpellCastResult CheckRequirement() + { + std::list ghouls; + GetCaster()->GetAllMinionsByEntry(ghouls, NPC_GHOUL); + if (ghouls.size() >= MAX_GHOULS) + { + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_TOO_MANY_GHOULS); + return SPELL_FAILED_CUSTOM_ERROR; + } + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_item_gift_of_the_harvester_SpellScript::CheckRequirement); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_gift_of_the_harvester_SpellScript(); + } +}; + +enum Sinkholes +{ + NPC_SOUTH_SINKHOLE = 25664, + NPC_NORTHEAST_SINKHOLE = 25665, + NPC_NORTHWEST_SINKHOLE = 25666, +}; + +class spell_item_map_of_the_geyser_fields : public SpellScriptLoader +{ + public: + spell_item_map_of_the_geyser_fields() : SpellScriptLoader("spell_item_map_of_the_geyser_fields") {} + + class spell_item_map_of_the_geyser_fields_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_map_of_the_geyser_fields_SpellScript); + + SpellCastResult CheckSinkholes() + { + Unit* caster = GetCaster(); + if (caster->FindNearestCreature(NPC_SOUTH_SINKHOLE, 30.0f, true) || + caster->FindNearestCreature(NPC_NORTHEAST_SINKHOLE, 30.0f, true) || + caster->FindNearestCreature(NPC_NORTHWEST_SINKHOLE, 30.0f, true)) + return SPELL_CAST_OK; + + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_BE_CLOSE_TO_SINKHOLE); + return SPELL_FAILED_CUSTOM_ERROR; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_item_map_of_the_geyser_fields_SpellScript::CheckSinkholes); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_map_of_the_geyser_fields_SpellScript(); + } +}; + +enum VanquishedClutchesSpells +{ + SPELL_CRUSHER = 64982, + SPELL_CONSTRICTOR = 64983, + SPELL_CORRUPTOR = 64984, +}; + +class spell_item_vanquished_clutches : public SpellScriptLoader +{ + public: + spell_item_vanquished_clutches() : SpellScriptLoader("spell_item_vanquished_clutches") { } + + class spell_item_vanquished_clutches_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_vanquished_clutches_SpellScript); + + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_CRUSHER) || !sSpellMgr->GetSpellInfo(SPELL_CONSTRICTOR) || !sSpellMgr->GetSpellInfo(SPELL_CORRUPTOR)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + uint32 spellId = RAND(SPELL_CRUSHER, SPELL_CONSTRICTOR, SPELL_CORRUPTOR); + Unit* caster = GetCaster(); + caster->CastSpell(caster, spellId, true); + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_item_vanquished_clutches_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_vanquished_clutches_SpellScript(); + } +}; + +enum AshbringerSounds +{ + SOUND_ASHBRINGER_1 = 8906, // "I was pure once" + SOUND_ASHBRINGER_2 = 8907, // "Fought for righteousness" + SOUND_ASHBRINGER_3 = 8908, // "I was once called Ashbringer" + SOUND_ASHBRINGER_4 = 8920, // "Betrayed by my order" + SOUND_ASHBRINGER_5 = 8921, // "Destroyed by Kel'Thuzad" + SOUND_ASHBRINGER_6 = 8922, // "Made to serve" + SOUND_ASHBRINGER_7 = 8923, // "My son watched me die" + SOUND_ASHBRINGER_8 = 8924, // "Crusades fed his rage" + SOUND_ASHBRINGER_9 = 8925, // "Truth is unknown to him" + SOUND_ASHBRINGER_10 = 8926, // "Scarlet Crusade is pure no longer" + SOUND_ASHBRINGER_11 = 8927, // "Balnazzar's crusade corrupted my son" + SOUND_ASHBRINGER_12 = 8928, // "Kill them all!" +}; + +class spell_item_ashbringer : public SpellScriptLoader +{ + public: + spell_item_ashbringer() : SpellScriptLoader("spell_item_ashbringer") {} + + class spell_item_ashbringer_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_ashbringer_SpellScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void OnDummyEffect(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + + Player* player = GetCaster()->ToPlayer(); + uint32 sound_id = RAND( SOUND_ASHBRINGER_1, SOUND_ASHBRINGER_2, SOUND_ASHBRINGER_3, SOUND_ASHBRINGER_4, SOUND_ASHBRINGER_5, SOUND_ASHBRINGER_6, + SOUND_ASHBRINGER_7, SOUND_ASHBRINGER_8, SOUND_ASHBRINGER_9, SOUND_ASHBRINGER_10, SOUND_ASHBRINGER_11, SOUND_ASHBRINGER_12 ); + + // Ashbringers effect (spellID 28441) retriggers every 5 seconds, with a chance of making it say one of the above 12 sounds + if (urand(0, 60) < 1) + player->PlayDirectSound(sound_id, player); + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_item_ashbringer_SpellScript::OnDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_ashbringer_SpellScript(); + } +}; + +enum MagicEater +{ + SPELL_WILD_MAGIC = 58891, + SPELL_WELL_FED_1 = 57288, + SPELL_WELL_FED_2 = 57139, + SPELL_WELL_FED_3 = 57111, + SPELL_WELL_FED_4 = 57286, + SPELL_WELL_FED_5 = 57291, +}; + +class spell_magic_eater_food : public SpellScriptLoader +{ + public: + spell_magic_eater_food() : SpellScriptLoader("spell_magic_eater_food") {} + + class spell_magic_eater_food_AuraScript : public AuraScript + { + PrepareAuraScript(spell_magic_eater_food_AuraScript); + + void HandleTriggerSpell(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + Unit* target = GetTarget(); + switch (urand(0, 5)) + { + case 0: + target->CastSpell(target, SPELL_WILD_MAGIC, true); + break; + case 1: + target->CastSpell(target, SPELL_WELL_FED_1, true); + break; + case 2: + target->CastSpell(target, SPELL_WELL_FED_2, true); + break; + case 3: + target->CastSpell(target, SPELL_WELL_FED_3, true); + break; + case 4: + target->CastSpell(target, SPELL_WELL_FED_4, true); + break; + case 5: + target->CastSpell(target, SPELL_WELL_FED_5, true); + break; + } + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_magic_eater_food_AuraScript::HandleTriggerSpell, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_magic_eater_food_AuraScript(); + } +}; + +class spell_item_shimmering_vessel : public SpellScriptLoader +{ + public: + spell_item_shimmering_vessel() : SpellScriptLoader("spell_item_shimmering_vessel") { } + + class spell_item_shimmering_vessel_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_shimmering_vessel_SpellScript); + + void HandleDummy(SpellEffIndex /* effIndex */) + { + if (Creature* target = GetHitCreature()) + target->setDeathState(JUST_ALIVED); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_shimmering_vessel_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_shimmering_vessel_SpellScript(); + } +}; + +enum PurifyHelboarMeat +{ + SPELL_SUMMON_PURIFIED_HELBOAR_MEAT = 29277, + SPELL_SUMMON_TOXIC_HELBOAR_MEAT = 29278, +}; + +class spell_item_purify_helboar_meat : public SpellScriptLoader +{ + public: + spell_item_purify_helboar_meat() : SpellScriptLoader("spell_item_purify_helboar_meat") { } + + class spell_item_purify_helboar_meat_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_purify_helboar_meat_SpellScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_PURIFIED_HELBOAR_MEAT) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_TOXIC_HELBOAR_MEAT)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + caster->CastSpell(caster, roll_chance_i(50) ? SPELL_SUMMON_PURIFIED_HELBOAR_MEAT : SPELL_SUMMON_TOXIC_HELBOAR_MEAT, true, NULL); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_purify_helboar_meat_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_purify_helboar_meat_SpellScript(); + } +}; + +enum CrystalPrison +{ + OBJECT_IMPRISONED_DOOMGUARD = 179644, +}; + +class spell_item_crystal_prison_dummy_dnd : public SpellScriptLoader +{ + public: + spell_item_crystal_prison_dummy_dnd() : SpellScriptLoader("spell_item_crystal_prison_dummy_dnd") { } + + class spell_item_crystal_prison_dummy_dnd_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_crystal_prison_dummy_dnd_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sObjectMgr->GetGameObjectTemplate(OBJECT_IMPRISONED_DOOMGUARD)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + if (Creature* target = GetHitCreature()) + if (target->isDead() && !target->isPet()) + { + GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0, 0, 0, 0, uint32(target->GetRespawnTime()-time(NULL))); + target->DespawnOrUnsummon(); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_crystal_prison_dummy_dnd_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_crystal_prison_dummy_dnd_SpellScript(); + } +}; + +enum ReindeerTransformation +{ + SPELL_FLYING_REINDEER_310 = 44827, + SPELL_FLYING_REINDEER_280 = 44825, + SPELL_FLYING_REINDEER_60 = 44824, + SPELL_REINDEER_100 = 25859, + SPELL_REINDEER_60 = 25858, +}; + +class spell_item_reindeer_transformation : public SpellScriptLoader +{ + public: + spell_item_reindeer_transformation() : SpellScriptLoader("spell_item_reindeer_transformation") { } + + class spell_item_reindeer_transformation_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_reindeer_transformation_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_FLYING_REINDEER_310) || !sSpellMgr->GetSpellInfo(SPELL_FLYING_REINDEER_280) + || !sSpellMgr->GetSpellInfo(SPELL_FLYING_REINDEER_60) || !sSpellMgr->GetSpellInfo(SPELL_REINDEER_100) + || !sSpellMgr->GetSpellInfo(SPELL_REINDEER_60)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + if (caster->HasAuraType(SPELL_AURA_MOUNTED)) + { + float flyspeed = caster->GetSpeedRate(MOVE_FLIGHT); + float speed = caster->GetSpeedRate(MOVE_RUN); + + caster->RemoveAurasByType(SPELL_AURA_MOUNTED); + //5 different spells used depending on mounted speed and if mount can fly or not + + if (flyspeed >= 4.1f) + // Flying Reindeer + caster->CastSpell(caster, SPELL_FLYING_REINDEER_310, true); //310% flying Reindeer + else if (flyspeed >= 3.8f) + // Flying Reindeer + caster->CastSpell(caster, SPELL_FLYING_REINDEER_280, true); //280% flying Reindeer + else if (flyspeed >= 1.6f) + // Flying Reindeer + caster->CastSpell(caster, SPELL_FLYING_REINDEER_60, true); //60% flying Reindeer + else if (speed >= 2.0f) + // Reindeer + caster->CastSpell(caster, SPELL_REINDEER_100, true); //100% ground Reindeer + else + // Reindeer + caster->CastSpell(caster, SPELL_REINDEER_60, true); //60% ground Reindeer + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_reindeer_transformation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_reindeer_transformation_SpellScript(); + } +}; + +enum NighInvulnerability +{ + SPELL_NIGH_INVULNERABILITY = 30456, + SPELL_COMPLETE_VULNERABILITY = 30457, +}; + +class spell_item_nigh_invulnerability : public SpellScriptLoader +{ + public: + spell_item_nigh_invulnerability() : SpellScriptLoader("spell_item_nigh_invulnerability") { } + + class spell_item_nigh_invulnerability_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_nigh_invulnerability_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_NIGH_INVULNERABILITY) || !sSpellMgr->GetSpellInfo(SPELL_COMPLETE_VULNERABILITY)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + if (Item* castItem = GetCastItem()) + if (roll_chance_i(86)) // Nigh-Invulnerability - success + caster->CastSpell(caster, SPELL_NIGH_INVULNERABILITY, true, castItem); + else // Complete Vulnerability - backfire in 14% casts + caster->CastSpell(caster, SPELL_COMPLETE_VULNERABILITY, true, castItem); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_nigh_invulnerability_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_nigh_invulnerability_SpellScript(); + } +}; + +enum Poultryzer +{ + SPELL_POULTRYIZER_SUCCESS = 30501, + SPELL_POULTRYIZER_BACKFIRE = 30504, +}; + +class spell_item_poultryizer : public SpellScriptLoader +{ + public: + spell_item_poultryizer() : SpellScriptLoader("spell_item_poultryizer") { } + + class spell_item_poultryizer_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_poultryizer_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_POULTRYIZER_SUCCESS) || !sSpellMgr->GetSpellInfo(SPELL_POULTRYIZER_BACKFIRE)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + if (GetCastItem() && GetHitUnit()) + GetCaster()->CastSpell(GetHitUnit(), roll_chance_i(80) ? SPELL_POULTRYIZER_SUCCESS : SPELL_POULTRYIZER_BACKFIRE , true, GetCastItem()); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_poultryizer_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_poultryizer_SpellScript(); + } +}; + +enum SocretharsStone +{ + SPELL_SOCRETHAR_TO_SEAT = 35743, + SPELL_SOCRETHAR_FROM_SEAT = 35744, +}; + +class spell_item_socrethars_stone : public SpellScriptLoader +{ + public: + spell_item_socrethars_stone() : SpellScriptLoader("spell_item_socrethars_stone") { } + + class spell_item_socrethars_stone_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_socrethars_stone_SpellScript); + + bool Load() + { + return (GetCaster()->GetAreaId() == 3900 || GetCaster()->GetAreaId() == 3742); + } + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_SOCRETHAR_TO_SEAT) || !sSpellMgr->GetSpellInfo(SPELL_SOCRETHAR_FROM_SEAT)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + switch (caster->GetAreaId()) + { + case 3900: + caster->CastSpell(caster, SPELL_SOCRETHAR_TO_SEAT, true); + break; + case 3742: + caster->CastSpell(caster, SPELL_SOCRETHAR_FROM_SEAT, true); + break; + default: + return; + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_socrethars_stone_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_socrethars_stone_SpellScript(); + } +}; + +enum DemonBroiledSurprise +{ + QUEST_SUPER_HOT_STEW = 11379, + SPELL_CREATE_DEMON_BROILED_SURPRISE = 43753, + NPC_ABYSSAL_FLAMEBRINGER = 19973, +}; + +class spell_item_demon_broiled_surprise : public SpellScriptLoader +{ + public: + spell_item_demon_broiled_surprise() : SpellScriptLoader("spell_item_demon_broiled_surprise") { } + + class spell_item_demon_broiled_surprise_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_demon_broiled_surprise_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_DEMON_BROILED_SURPRISE) || !sObjectMgr->GetCreatureTemplate(NPC_ABYSSAL_FLAMEBRINGER) || !sObjectMgr->GetQuestTemplate(QUEST_SUPER_HOT_STEW)) + return false; + return true; + } + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* player = GetCaster(); + player->CastSpell(player, SPELL_CREATE_DEMON_BROILED_SURPRISE, false); + } + + SpellCastResult CheckRequirement() + { + Player* player = GetCaster()->ToPlayer(); + if (player->GetQuestStatus(QUEST_SUPER_HOT_STEW) != QUEST_STATUS_INCOMPLETE) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + + if (Creature* creature = player->FindNearestCreature(NPC_ABYSSAL_FLAMEBRINGER, 10, false)) + if (creature->isDead()) + return SPELL_CAST_OK; + return SPELL_FAILED_NOT_HERE; + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_demon_broiled_surprise_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); + OnCheckCast += SpellCheckCastFn(spell_item_demon_broiled_surprise_SpellScript::CheckRequirement); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_demon_broiled_surprise_SpellScript(); + } +}; + +enum CompleteRaptorCapture +{ + SPELL_RAPTOR_CAPTURE_CREDIT = 42337, +}; + +class spell_item_complete_raptor_capture : public SpellScriptLoader +{ + public: + spell_item_complete_raptor_capture() : SpellScriptLoader("spell_item_complete_raptor_capture") { } + + class spell_item_complete_raptor_capture_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_complete_raptor_capture_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_RAPTOR_CAPTURE_CREDIT)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + if (GetHitCreature()) + { + GetHitCreature()->DespawnOrUnsummon(); + + //cast spell Raptor Capture Credit + caster->CastSpell(caster, SPELL_RAPTOR_CAPTURE_CREDIT, true, NULL); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_complete_raptor_capture_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_complete_raptor_capture_SpellScript(); + } +}; + +enum ImpaleLeviroth { - SPELL_AIR_RIFLE_HOLD_VISUAL = 65582, - SPELL_AIR_RIFLE_SHOOT = 67532, - SPELL_AIR_RIFLE_SHOOT_SELF = 65577, + NPC_LEVIROTH = 26452, }; -class spell_item_red_rider_air_rifle : public SpellScriptLoader +class spell_item_impale_leviroth : public SpellScriptLoader { public: - spell_item_red_rider_air_rifle() : SpellScriptLoader("spell_item_red_rider_air_rifle") { } + spell_item_impale_leviroth() : SpellScriptLoader("spell_item_impale_leviroth") { } - class spell_item_red_rider_air_rifle_SpellScript : public SpellScript + class spell_item_impale_leviroth_SpellScript : public SpellScript { - PrepareSpellScript(spell_item_red_rider_air_rifle_SpellScript); + PrepareSpellScript(spell_item_impale_leviroth_SpellScript); + + bool Load() + { + return GetHitCreature()->GetEntry() == NPC_LEVIROTH; + } bool Validate(SpellInfo const* /*spell*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_AIR_RIFLE_HOLD_VISUAL)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_AIR_RIFLE_SHOOT)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_AIR_RIFLE_SHOOT_SELF)) + if (!sObjectMgr->GetCreatureTemplate(NPC_LEVIROTH)) return false; return true; } - void HandleScript(SpellEffIndex effIndex) + void HandleDummy(SpellEffIndex /* effIndex */) { - PreventHitDefaultEffect(effIndex); - if (!GetHitUnit()) - return; - - GetCaster()->CastSpell(GetCaster(), SPELL_AIR_RIFLE_HOLD_VISUAL, true); - // needed because this spell shares GCD with its triggered spells (which must not be cast with triggered flag) - if (Player* player = GetCaster()->ToPlayer()) - player->GetGlobalCooldownMgr().CancelGlobalCooldown(GetSpellInfo()); - if (urand(0, 4)) - GetCaster()->CastSpell(GetHitUnit(), SPELL_AIR_RIFLE_SHOOT, false); - else - GetCaster()->CastSpell(GetCaster(), SPELL_AIR_RIFLE_SHOOT_SELF, false); + Unit* caster = GetCaster(); + if (Unit* target = GetHitCreature()) + if (target->HealthBelowPct(95)) + caster->DealDamage(target, target->CountPctFromMaxHealth(93)); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_item_red_rider_air_rifle_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_item_impale_leviroth_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const { - return new spell_item_red_rider_air_rifle_SpellScript(); + return new spell_item_impale_leviroth_SpellScript(); } }; -enum eGenericData -{ - SPELL_ARCANITE_DRAGONLING = 19804, - SPELL_BATTLE_CHICKEN = 13166, - SPELL_MECHANICAL_DRAGONLING = 4073, - SPELL_MITHRIL_MECHANICAL_DRAGONLING = 12749, -}; - -enum CreateHeartCandy +enum BrewfestMountTransformation { - ITEM_HEART_CANDY_1 = 21818, - ITEM_HEART_CANDY_2 = 21817, - ITEM_HEART_CANDY_3 = 21821, - ITEM_HEART_CANDY_4 = 21819, - ITEM_HEART_CANDY_5 = 21816, - ITEM_HEART_CANDY_6 = 21823, - ITEM_HEART_CANDY_7 = 21822, - ITEM_HEART_CANDY_8 = 21820, + SPELL_MOUNT_RAM_100 = 43900, + SPELL_MOUNT_RAM_60 = 43899, + SPELL_MOUNT_KODO_100 = 49379, + SPELL_MOUNT_KODO_60 = 49378, + SPELL_BREWFEST_MOUNT_TRANSFORM = 49357, + SPELL_BREWFEST_MOUNT_TRANSFORM_REVERSE = 52845, }; -class spell_item_create_heart_candy : public SpellScriptLoader +class spell_item_brewfest_mount_transformation : public SpellScriptLoader { public: - spell_item_create_heart_candy() : SpellScriptLoader("spell_item_create_heart_candy") { } + spell_item_brewfest_mount_transformation() : SpellScriptLoader("spell_item_brewfest_mount_transformation") { } - class spell_item_create_heart_candy_SpellScript : public SpellScript + class spell_item_brewfest_mount_transformation_SpellScript : public SpellScript { - PrepareSpellScript(spell_item_create_heart_candy_SpellScript); + PrepareSpellScript(spell_item_brewfest_mount_transformation_SpellScript); - void HandleScript(SpellEffIndex effIndex) + bool Validate(SpellInfo const* /*spell*/) { - PreventHitDefaultEffect(effIndex); - if (!GetHitUnit() || !GetHitUnit()->ToPlayer()) - return; - - Player* target = GetHitUnit()->ToPlayer(); - - static const uint32 items[] = {ITEM_HEART_CANDY_1, ITEM_HEART_CANDY_2, ITEM_HEART_CANDY_3, ITEM_HEART_CANDY_4, ITEM_HEART_CANDY_5, ITEM_HEART_CANDY_6, ITEM_HEART_CANDY_7, ITEM_HEART_CANDY_8}; + if (!sSpellMgr->GetSpellInfo(SPELL_MOUNT_RAM_100) || !sSpellMgr->GetSpellInfo(SPELL_MOUNT_RAM_60) || !sSpellMgr->GetSpellInfo(SPELL_MOUNT_KODO_100) || !sSpellMgr->GetSpellInfo(SPELL_MOUNT_KODO_60)) + return false; + return true; + } - target->AddItem(items[urand(0, 7)], 1); + void HandleDummy(SpellEffIndex /* effIndex */) + { + Player* caster = GetCaster()->ToPlayer(); + if (caster->HasAuraType(SPELL_AURA_MOUNTED)) + { + caster->RemoveAurasByType(SPELL_AURA_MOUNTED); + uint32 spell_id; + + switch (GetSpellInfo()->Id) + { + case SPELL_BREWFEST_MOUNT_TRANSFORM: + if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f) + spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100 ; + else + spell_id = caster->GetTeam() == ALLIANCE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60 ; + break; + case SPELL_BREWFEST_MOUNT_TRANSFORM_REVERSE: + if (caster->GetSpeedRate(MOVE_RUN) >= 2.0f) + spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_100 : SPELL_MOUNT_KODO_100 ; + else + spell_id = caster->GetTeam() == HORDE ? SPELL_MOUNT_RAM_60 : SPELL_MOUNT_KODO_60 ; + break; + default: + return; + } + caster->CastSpell(caster, spell_id, true); + } } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_item_create_heart_candy_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + OnEffectHitTarget += SpellEffectFn(spell_item_brewfest_mount_transformation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const { - return new spell_item_create_heart_candy_SpellScript(); + return new spell_item_brewfest_mount_transformation_SpellScript(); } }; -class spell_item_book_of_glyph_mastery : public SpellScriptLoader +enum NitroBoots +{ + SPELL_NITRO_BOOTS_SUCCESS = 54861, + SPELL_NITRO_BOOTS_BACKFIRE = 46014, +}; + +class spell_item_nitro_boots : public SpellScriptLoader { public: - spell_item_book_of_glyph_mastery() : SpellScriptLoader("spell_item_book_of_glyph_mastery") {} + spell_item_nitro_boots() : SpellScriptLoader("spell_item_nitro_boots") { } - class spell_item_book_of_glyph_mastery_SpellScript : public SpellScript + class spell_item_nitro_boots_SpellScript : public SpellScript { - PrepareSpellScript(spell_item_book_of_glyph_mastery_SpellScript); + PrepareSpellScript(spell_item_nitro_boots_SpellScript); - SpellCastResult CheckRequirement() + bool Load() { - if (GetCaster()->GetTypeId() == TYPEID_PLAYER && HasDiscoveredAllSpells(GetSpellInfo()->Id, GetCaster()->ToPlayer())) - { - SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_LEARNED_EVERYTHING); - return SPELL_FAILED_CUSTOM_ERROR; - } + if (!GetCastItem()) + return false; + return true; + } - return SPELL_CAST_OK; + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_NITRO_BOOTS_SUCCESS) || !sSpellMgr->GetSpellInfo(SPELL_NITRO_BOOTS_BACKFIRE)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + caster->CastSpell(caster, roll_chance_i(95) ? SPELL_NITRO_BOOTS_SUCCESS : SPELL_NITRO_BOOTS_BACKFIRE, true, GetCastItem()); } void Register() { - OnCheckCast += SpellCheckCastFn(spell_item_book_of_glyph_mastery_SpellScript::CheckRequirement); + OnEffectHitTarget += SpellEffectFn(spell_item_nitro_boots_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const { - return new spell_item_book_of_glyph_mastery_SpellScript(); + return new spell_item_nitro_boots_SpellScript(); } }; -enum GiftOfTheHarvester +enum TeachLanguage { - NPC_GHOUL = 28845, - MAX_GHOULS = 5, + SPELL_LEARN_GNOMISH_BINARY = 50242, + SPELL_LEARN_GOBLIN_BINARY = 50246, }; -class spell_item_gift_of_the_harvester : public SpellScriptLoader +class spell_item_teach_language : public SpellScriptLoader { public: - spell_item_gift_of_the_harvester() : SpellScriptLoader("spell_item_gift_of_the_harvester") {} + spell_item_teach_language() : SpellScriptLoader("spell_item_teach_language") { } - class spell_item_gift_of_the_harvester_SpellScript : public SpellScript + class spell_item_teach_language_SpellScript : public SpellScript { - PrepareSpellScript(spell_item_gift_of_the_harvester_SpellScript); + PrepareSpellScript(spell_item_teach_language_SpellScript); - SpellCastResult CheckRequirement() + bool Load() { - std::list ghouls; - GetCaster()->GetAllMinionsByEntry(ghouls, NPC_GHOUL); - if (ghouls.size() >= MAX_GHOULS) - { - SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_TOO_MANY_GHOULS); - return SPELL_FAILED_CUSTOM_ERROR; - } + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - return SPELL_CAST_OK; + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_LEARN_GNOMISH_BINARY) || !sSpellMgr->GetSpellInfo(SPELL_LEARN_GOBLIN_BINARY)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Player* caster = GetCaster()->ToPlayer(); + + if (roll_chance_i(34)) + caster->CastSpell(caster,caster->GetTeam() == ALLIANCE ? SPELL_LEARN_GNOMISH_BINARY : SPELL_LEARN_GOBLIN_BINARY, true); } void Register() { - OnCheckCast += SpellCheckCastFn(spell_item_gift_of_the_harvester_SpellScript::CheckRequirement); + OnEffectHitTarget += SpellEffectFn(spell_item_teach_language_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const { - return new spell_item_gift_of_the_harvester_SpellScript(); + return new spell_item_teach_language_SpellScript(); } }; -enum Sinkholes +enum RocketBoots { - NPC_SOUTH_SINKHOLE = 25664, - NPC_NORTHEAST_SINKHOLE = 25665, - NPC_NORTHWEST_SINKHOLE = 25666, + SPELL_ROCKET_BOOTS_PROC = 30452, }; -class spell_item_map_of_the_geyser_fields : public SpellScriptLoader +class spell_item_rocket_boots : public SpellScriptLoader { public: - spell_item_map_of_the_geyser_fields() : SpellScriptLoader("spell_item_map_of_the_geyser_fields") {} + spell_item_rocket_boots() : SpellScriptLoader("spell_item_rocket_boots") { } - class spell_item_map_of_the_geyser_fields_SpellScript : public SpellScript + class spell_item_rocket_boots_SpellScript : public SpellScript { - PrepareSpellScript(spell_item_map_of_the_geyser_fields_SpellScript); + PrepareSpellScript(spell_item_rocket_boots_SpellScript); - SpellCastResult CheckSinkholes() + bool Load() { - Unit* caster = GetCaster(); - if (caster->FindNearestCreature(NPC_SOUTH_SINKHOLE, 30.0f, true) || - caster->FindNearestCreature(NPC_NORTHEAST_SINKHOLE, 30.0f, true) || - caster->FindNearestCreature(NPC_NORTHWEST_SINKHOLE, 30.0f, true)) - return SPELL_CAST_OK; + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_BE_CLOSE_TO_SINKHOLE); - return SPELL_FAILED_CUSTOM_ERROR; + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_ROCKET_BOOTS_PROC)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Player* caster = GetCaster()->ToPlayer(); + if (Battleground* bg = caster->GetBattleground()) + bg->EventPlayerDroppedFlag(caster); + + caster->CastSpell(caster, SPELL_ROCKET_BOOTS_PROC, true, NULL); } void Register() { - OnCheckCast += SpellCheckCastFn(spell_item_map_of_the_geyser_fields_SpellScript::CheckSinkholes); + OnEffectHitTarget += SpellEffectFn(spell_item_rocket_boots_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const { - return new spell_item_map_of_the_geyser_fields_SpellScript(); + return new spell_item_rocket_boots_SpellScript(); } }; -enum VanquishedClutchesSpells +enum PygmyOil { - SPELL_CRUSHER = 64982, - SPELL_CONSTRICTOR = 64983, - SPELL_CORRUPTOR = 64984, + SPELL_PYGMY_OIL_PYGMY_AURA = 53806, + SPELL_PYGMY_OIL_SMALLER_AURA = 53805, }; -class spell_item_vanquished_clutches : public SpellScriptLoader +class spell_item_pygmy_oil : public SpellScriptLoader { public: - spell_item_vanquished_clutches() : SpellScriptLoader("spell_item_vanquished_clutches") { } + spell_item_pygmy_oil() : SpellScriptLoader("spell_item_pygmy_oil") { } - class spell_item_vanquished_clutches_SpellScript : public SpellScript + class spell_item_pygmy_oil_SpellScript : public SpellScript { - PrepareSpellScript(spell_item_vanquished_clutches_SpellScript); + PrepareSpellScript(spell_item_pygmy_oil_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spell*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_CRUSHER)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_CONSTRICTOR)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_CORRUPTOR)) + if (!sSpellMgr->GetSpellInfo(SPELL_PYGMY_OIL_PYGMY_AURA) || !sSpellMgr->GetSpellInfo(SPELL_PYGMY_OIL_SMALLER_AURA)) return false; return true; } - void HandleDummy(SpellEffIndex /*effIndex*/) + void HandleDummy(SpellEffIndex /* effIndex */) { - uint32 spellId = RAND(SPELL_CRUSHER, SPELL_CONSTRICTOR, SPELL_CORRUPTOR); - GetCaster()->CastSpell(GetCaster(), spellId, true); + Unit* caster = GetCaster(); + if (Aura* aura = caster->GetAura(SPELL_PYGMY_OIL_PYGMY_AURA)) + aura->RefreshDuration(); + else + { + aura = caster->GetAura(SPELL_PYGMY_OIL_SMALLER_AURA); + if (!aura || aura->GetStackAmount() < 5 || !roll_chance_i(50)) + caster->CastSpell(caster, SPELL_PYGMY_OIL_SMALLER_AURA, true); + else + { + aura->Remove(); + caster->CastSpell(caster, SPELL_PYGMY_OIL_PYGMY_AURA, true); + } + } } void Register() { - OnEffectHit += SpellEffectFn(spell_item_vanquished_clutches_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_item_pygmy_oil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const { - return new spell_item_vanquished_clutches_SpellScript(); + return new spell_item_pygmy_oil_SpellScript(); } }; -enum AshbringerSounds +class spell_item_unusual_compass : public SpellScriptLoader { - SOUND_ASHBRINGER_1 = 8906, // "I was pure once" - SOUND_ASHBRINGER_2 = 8907, // "Fought for righteousness" - SOUND_ASHBRINGER_3 = 8908, // "I was once called Ashbringer" - SOUND_ASHBRINGER_4 = 8920, // "Betrayed by my order" - SOUND_ASHBRINGER_5 = 8921, // "Destroyed by Kel'Thuzad" - SOUND_ASHBRINGER_6 = 8922, // "Made to serve" - SOUND_ASHBRINGER_7 = 8923, // "My son watched me die" - SOUND_ASHBRINGER_8 = 8924, // "Crusades fed his rage" - SOUND_ASHBRINGER_9 = 8925, // "Truth is unknown to him" - SOUND_ASHBRINGER_10 = 8926, // "Scarlet Crusade is pure no longer" - SOUND_ASHBRINGER_11 = 8927, // "Balnazzar's crusade corrupted my son" - SOUND_ASHBRINGER_12 = 8928, // "Kill them all!" + public: + spell_item_unusual_compass() : SpellScriptLoader("spell_item_unusual_compass") { } + + class spell_item_unusual_compass_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_unusual_compass_SpellScript); + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Unit* caster = GetCaster(); + caster->SetOrientation(frand(0.0f, 62832.0f) / 10000.0f); + caster->SendMovementFlagUpdate(); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_item_unusual_compass_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SPELL_ASHBRINGER = 28282, // Ashbringer - Inflicts the will of the Ashbringer upon the wielder - SPELL_ASHBRINGER_TR = 28441 // AB Effect 000 + SpellScript* GetSpellScript() const + { + return new spell_item_unusual_compass_SpellScript(); + } }; -class spell_item_ashbringer : public SpellScriptLoader +enum UDED +{ + NPC_IRONWOOL_MAMMOTH = 53806, + SPELL_MAMMOTH_CARCASS = 57444, + SPELL_MAMMOTH_MEAT = 54625, +}; + +class spell_item_uded : public SpellScriptLoader { public: - spell_item_ashbringer() : SpellScriptLoader("spell_item_ashbringer") {} + spell_item_uded() : SpellScriptLoader("spell_item_uded") { } - class spell_item_ashbringer_SpellScript : public SpellScript + class spell_item_uded_SpellScript : public SpellScript { - PrepareSpellScript(spell_item_ashbringer_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) + PrepareSpellScript(spell_item_uded_SpellScript); + + bool Load() + { + if (GetHitCreature() && GetHitCreature()->GetEntry() == NPC_IRONWOOL_MAMMOTH) + return true; + return false; + } + + bool Validate(SpellInfo const* /*spell*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_ASHBRINGER)) + if (!sSpellMgr->GetSpellInfo(SPELL_MAMMOTH_CARCASS) || !sSpellMgr->GetSpellInfo(SPELL_MAMMOTH_MEAT)) return false; return true; } - void OnDummyEffect(SpellEffIndex effIndex) + void HandleDummy(SpellEffIndex /* effIndex */) { - PreventHitDefaultEffect(effIndex); - Unit* caster = GetCaster(); - if (Player* player = caster->ToPlayer()) - { - uint32 sound_id = RAND( SOUND_ASHBRINGER_1, SOUND_ASHBRINGER_2, SOUND_ASHBRINGER_3, SOUND_ASHBRINGER_4, SOUND_ASHBRINGER_5, SOUND_ASHBRINGER_6, - SOUND_ASHBRINGER_7, SOUND_ASHBRINGER_8, SOUND_ASHBRINGER_9, SOUND_ASHBRINGER_10, SOUND_ASHBRINGER_11, SOUND_ASHBRINGER_12 ); + Creature* creature = GetHitCreature(); + caster->CastSpell(caster,SPELL_MAMMOTH_CARCASS,true); - // Ashbringers effect (spellID 28441) retriggers every 5 seconds, with a chance of making it say one of the above 12 sounds - if (urand(0, 60) < 1) - player->PlayDirectSound(sound_id, player); - } + for (uint8 i = 0; i < 4; ++i) + caster->CastSpell(caster,SPELL_MAMMOTH_MEAT,true); + + creature->Kill(creature); } void Register() { - OnEffectHit += SpellEffectFn(spell_item_ashbringer_SpellScript::OnDummyEffect, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_item_uded_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const { - return new spell_item_ashbringer_SpellScript(); + return new spell_item_uded_SpellScript(); } }; -enum MagicEater +enum ChickenCover { - SPELL_WILD_MAGIC = 58891, - SPELL_WELL_FED_1 = 57288, - SPELL_WELL_FED_2 = 57139, - SPELL_WELL_FED_3 = 57111, - SPELL_WELL_FED_4 = 57286, - SPELL_WELL_FED_5 = 57291, + SPELL_CHICKEN_NET = 51959, + SPELL_CAPTURE_CHICKEN_ESCAPE = 51037, + QUEST_CHICKEN_PARTY = 12702, + QUEST_FLOWN_THE_COOP = 12532, }; -class spell_magic_eater_food : public SpellScriptLoader +class spell_item_chicken_cover : public SpellScriptLoader { public: - spell_magic_eater_food() : SpellScriptLoader("spell_magic_eater_food") - { - } + spell_item_chicken_cover() : SpellScriptLoader("spell_item_chicken_cover") { } - class spell_magic_eater_food_AuraScript : public AuraScript + class spell_item_chicken_cover_SpellScript : public SpellScript { - PrepareAuraScript(spell_magic_eater_food_AuraScript); + PrepareSpellScript(spell_item_chicken_cover_SpellScript); - void HandleTriggerSpell(AuraEffect const* /*aurEff*/) + bool Load() { - PreventDefaultAction(); - Unit* target = GetTarget(); + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } - switch (urand(0, 5)) + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_CHICKEN_NET) || !sSpellMgr->GetSpellInfo(SPELL_CAPTURE_CHICKEN_ESCAPE) || !sObjectMgr->GetQuestTemplate(QUEST_CHICKEN_PARTY) || !sObjectMgr->GetQuestTemplate(QUEST_FLOWN_THE_COOP)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + Player* caster = GetCaster()->ToPlayer(); + if (Unit* target = GetHitUnit()) { - case 0: - target->CastSpell(target, SPELL_WILD_MAGIC, true); - break; - case 1: - target->CastSpell(target, SPELL_WELL_FED_1, true); - break; - case 2: - target->CastSpell(target, SPELL_WELL_FED_2, true); - break; - case 3: - target->CastSpell(target, SPELL_WELL_FED_3, true); - break; - case 4: - target->CastSpell(target, SPELL_WELL_FED_4, true); - break; - case 5: - target->CastSpell(target, SPELL_WELL_FED_5, true); - break; + if (!target->HasAura(SPELL_CHICKEN_NET) && (caster->GetQuestStatus(QUEST_CHICKEN_PARTY) == QUEST_STATUS_INCOMPLETE || caster->GetQuestStatus(QUEST_FLOWN_THE_COOP) == QUEST_STATUS_INCOMPLETE)) + { + caster->CastSpell(caster, SPELL_CAPTURE_CHICKEN_ESCAPE, true); + target->Kill(target); } + } } void Register() { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_magic_eater_food_AuraScript::HandleTriggerSpell, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + OnEffectHitTarget += SpellEffectFn(spell_item_chicken_cover_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; - AuraScript* GetAuraScript() const + SpellScript* GetSpellScript() const { - return new spell_magic_eater_food_AuraScript(); + return new spell_item_chicken_cover_SpellScript(); } }; @@ -1206,4 +2022,22 @@ void AddSC_item_spell_scripts() new spell_item_ashbringer(); new spell_magic_eater_food(); new spell_item_refocus(); + new spell_item_shimmering_vessel(); + new spell_item_purify_helboar_meat(); + new spell_item_crystal_prison_dummy_dnd(); + new spell_item_reindeer_transformation(); + new spell_item_nigh_invulnerability(); + new spell_item_poultryizer(); + new spell_item_socrethars_stone(); + new spell_item_demon_broiled_surprise(); + new spell_item_complete_raptor_capture(); + new spell_item_impale_leviroth(); + new spell_item_brewfest_mount_transformation(); + new spell_item_nitro_boots(); + new spell_item_teach_language(); + new spell_item_rocket_boots(); + new spell_item_pygmy_oil(); + new spell_item_unusual_compass(); + new spell_item_uded(); + new spell_item_chicken_cover(); } diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index b0b619c8b08..181b89ed5f8 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -21,7 +21,6 @@ * Scriptnames of files in this file should be prefixed with "spell_mage_". */ -#include "ScriptPCH.h" enum MageSpells { @@ -45,7 +44,8 @@ class spell_mage_blast_wave : public SpellScriptLoader class spell_mage_blast_wave_SpellScript : public SpellScript { - PrepareSpellScript(spell_mage_blast_wave_SpellScript) + PrepareSpellScript(spell_mage_blast_wave_SpellScript); + bool Validate(SpellInfo const* /*spellEntry*/) { if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_GLYPH_OF_BLAST_WAVE)) @@ -78,16 +78,19 @@ class spell_mage_cold_snap : public SpellScriptLoader class spell_mage_cold_snap_SpellScript : public SpellScript { - PrepareSpellScript(spell_mage_cold_snap_SpellScript) - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); + PrepareSpellScript(spell_mage_cold_snap_SpellScript); - if (caster->GetTypeId() != TYPEID_PLAYER) - return; + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + void HandleDummy(SpellEffIndex /*effIndex*/) + { + + Player* caster = GetCaster()->ToPlayer(); // immediately finishes the cooldown on Frost spells - const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap(); + const SpellCooldowns& cm = caster->GetSpellCooldownMap(); for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); @@ -96,7 +99,7 @@ class spell_mage_cold_snap : public SpellScriptLoader (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) && spellInfo->Id != SPELL_MAGE_COLD_SNAP && spellInfo->GetRecoveryTime() > 0) { - caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true); + caster->RemoveSpellCooldown((itr++)->first, true); } else ++itr; @@ -123,7 +126,8 @@ class spell_mage_polymorph_cast_visual : public SpellScriptLoader class spell_mage_polymorph_cast_visual_SpellScript : public SpellScript { - PrepareSpellScript(spell_mage_polymorph_cast_visual_SpellScript) + PrepareSpellScript(spell_mage_polymorph_cast_visual_SpellScript); + static const uint32 spell_list[6]; bool Validate(SpellInfo const* /*spellEntry*/) @@ -172,14 +176,11 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader class spell_mage_summon_water_elemental_SpellScript : public SpellScript { - PrepareSpellScript(spell_mage_summon_water_elemental_SpellScript) + PrepareSpellScript(spell_mage_summon_water_elemental_SpellScript); + bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT)) + if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_GLYPH_OF_ETERNAL_WATER) || !sSpellMgr->GetSpellInfo(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY) || !sSpellMgr->GetSpellInfo(SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT)) return false; return true; } @@ -210,78 +211,79 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader // Frost Warding class spell_mage_frost_warding_trigger : public SpellScriptLoader { -public: - spell_mage_frost_warding_trigger() : SpellScriptLoader("spell_mage_frost_warding_trigger") { } - - class spell_mage_frost_warding_trigger_AuraScript : public AuraScript - { - PrepareAuraScript(spell_mage_frost_warding_trigger_AuraScript); + public: + spell_mage_frost_warding_trigger() : SpellScriptLoader("spell_mage_frost_warding_trigger") { } - enum Spells + class spell_mage_frost_warding_trigger_AuraScript : public AuraScript { - SPELL_MAGE_FROST_WARDING_TRIGGERED = 57776, - SPELL_MAGE_FROST_WARDING_R1 = 28332, - }; + PrepareAuraScript(spell_mage_frost_warding_trigger_AuraScript); - bool Validate(SpellInfo const* /*spellEntry*/) - { - return sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_TRIGGERED) - && sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_R1); - } + enum Spells + { + SPELL_MAGE_FROST_WARDING_TRIGGERED = 57776, + SPELL_MAGE_FROST_WARDING_R1 = 28332, + }; - void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) - { - Unit* target = GetTarget(); - if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_FROST_WARDING_R1, EFFECT_0)) + bool Validate(SpellInfo const* /*spellEntry*/) { - int32 chance = talentAurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + if (!sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_TRIGGERED) || !sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_R1)) + return false; + return true; + } - if (roll_chance_i(chance)) + void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) + { + Unit* target = GetTarget(); + if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_FROST_WARDING_R1, EFFECT_0)) { - absorbAmount = dmgInfo.GetDamage(); - int32 bp = absorbAmount; - target->CastCustomSpell(target, SPELL_MAGE_FROST_WARDING_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); + int32 chance = talentAurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + + if (roll_chance_i(chance)) + { + absorbAmount = dmgInfo.GetDamage(); + int32 bp = absorbAmount; + target->CastCustomSpell(target, SPELL_MAGE_FROST_WARDING_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); + } } } - } - void Register() + void Register() + { + OnEffectAbsorb += AuraEffectAbsorbFn(spell_mage_frost_warding_trigger_AuraScript::Absorb, EFFECT_0); + } + }; + + AuraScript* GetAuraScript() const { - OnEffectAbsorb += AuraEffectAbsorbFn(spell_mage_frost_warding_trigger_AuraScript::Absorb, EFFECT_0); + return new spell_mage_frost_warding_trigger_AuraScript(); } - }; - - AuraScript* GetAuraScript() const - { - return new spell_mage_frost_warding_trigger_AuraScript(); - } }; class spell_mage_incanters_absorbtion_base_AuraScript : public AuraScript { -public: - enum Spells - { - SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED = 44413, - SPELL_MAGE_INCANTERS_ABSORBTION_R1 = 44394, - }; - - bool Validate(SpellInfo const* /*spellEntry*/) - { - return sSpellMgr->GetSpellInfo(SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED) - && sSpellMgr->GetSpellInfo(SPELL_MAGE_INCANTERS_ABSORBTION_R1); - } + public: + enum Spells + { + SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED = 44413, + SPELL_MAGE_INCANTERS_ABSORBTION_R1 = 44394, + }; - void Trigger(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) - { - Unit* target = GetTarget(); + bool Validate(SpellInfo const* /*spellEntry*/) + { + return sSpellMgr->GetSpellInfo(SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED) + && sSpellMgr->GetSpellInfo(SPELL_MAGE_INCANTERS_ABSORBTION_R1); + } - if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0)) + void Trigger(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) { - int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount()); - target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); + Unit* target = GetTarget(); + + if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0)) + { + int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount()); + target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); + } } - } }; // Incanter's Absorption diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 39360e04aa1..0ef158fe4bf 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -21,8 +21,9 @@ * Scriptnames of files in this file should be prefixed with "spell_pal_". */ -#include "ScriptPCH.h" #include "SpellAuraEffects.h" +#include "Unit.h" + enum PaladinSpells { @@ -46,323 +47,369 @@ enum PaladinSpells // 31850 - Ardent Defender class spell_pal_ardent_defender : public SpellScriptLoader { -public: - spell_pal_ardent_defender() : SpellScriptLoader("spell_pal_ardent_defender") { } + public: + spell_pal_ardent_defender() : SpellScriptLoader("spell_pal_ardent_defender") { } - class spell_pal_ardent_defender_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_ardent_defender_AuraScript); + class spell_pal_ardent_defender_AuraScript : public AuraScript + { + PrepareAuraScript(spell_pal_ardent_defender_AuraScript); - uint32 absorbPct, healPct; + uint32 absorbPct, healPct; - enum Spell - { - PAL_SPELL_ARDENT_DEFENDER_HEAL = 66235, - }; + enum Spell + { + PAL_SPELL_ARDENT_DEFENDER_HEAL = 66235, + }; - bool Load() - { - healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); - return GetUnitOwner()->ToPlayer(); - } + bool Load() + { + healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); + return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER; + } - void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) - { - // Set absorbtion amount to unlimited - amount = -1; - } + void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) + { + // Set absorbtion amount to unlimited + amount = -1; + } - void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) - { - Unit* victim = GetTarget(); - int32 remainingHealth = victim->GetHealth() - dmgInfo.GetDamage(); - uint32 allowedHealth = victim->CountPctFromMaxHealth(35); - // If damage kills us - if (remainingHealth <= 0 && !victim->ToPlayer()->HasSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL)) + void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) { - // Cast healing spell, completely avoid damage - absorbAmount = dmgInfo.GetDamage(); - - uint32 defenseSkillValue = victim->GetDefenseSkillValue(); - // Max heal when defense skill denies critical hits from raid bosses - // Formula: max defense at level + 140 (raiting from gear) - uint32 reqDefForMaxHeal = victim->getLevel() * 5 + 140; - float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal) - ? 1.0f - : float(defenseSkillValue) / float(reqDefForMaxHeal); - - int32 healAmount = int32(victim->CountPctFromMaxHealth(uint32(healPct * pctFromDefense))); - victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff); - victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, time(NULL) + 120); + Unit* victim = GetTarget(); + int32 remainingHealth = victim->GetHealth() - dmgInfo.GetDamage(); + uint32 allowedHealth = victim->CountPctFromMaxHealth(35); + // If damage kills us + if (remainingHealth <= 0 && !victim->ToPlayer()->HasSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL)) + { + // Cast healing spell, completely avoid damage + absorbAmount = dmgInfo.GetDamage(); + + uint32 defenseSkillValue = victim->GetDefenseSkillValue(); + // Max heal when defense skill denies critical hits from raid bosses + // Formula: max defense at level + 140 (raiting from gear) + uint32 reqDefForMaxHeal = victim->getLevel() * 5 + 140; + float pctFromDefense = (defenseSkillValue >= reqDefForMaxHeal) + ? 1.0f + : float(defenseSkillValue) / float(reqDefForMaxHeal); + + int32 healAmount = int32(victim->CountPctFromMaxHealth(uint32(healPct * pctFromDefense))); + victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, NULL, NULL, true, NULL, aurEff); + victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, time(NULL) + 120); + } + else if (remainingHealth < int32(allowedHealth)) + { + // Reduce damage that brings us under 35% (or full damage if we are already under 35%) by x% + uint32 damageToReduce = (victim->GetHealth() < allowedHealth) + ? dmgInfo.GetDamage() + : allowedHealth - remainingHealth; + absorbAmount = CalculatePctN(damageToReduce, absorbPct); + } } - else if (remainingHealth < int32(allowedHealth)) + + void Register() { - // Reduce damage that brings us under 35% (or full damage if we are already under 35%) by x% - uint32 damageToReduce = (victim->GetHealth() < allowedHealth) - ? dmgInfo.GetDamage() - : allowedHealth - remainingHealth; - absorbAmount = CalculatePctN(damageToReduce, absorbPct); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_ardent_defender_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_pal_ardent_defender_AuraScript::Absorb, EFFECT_0); } - } + }; - void Register() + AuraScript* GetAuraScript() const { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_pal_ardent_defender_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); - OnEffectAbsorb += AuraEffectAbsorbFn(spell_pal_ardent_defender_AuraScript::Absorb, EFFECT_0); + return new spell_pal_ardent_defender_AuraScript(); } - }; - - AuraScript* GetAuraScript() const - { - return new spell_pal_ardent_defender_AuraScript(); - } }; class spell_pal_blessing_of_faith : public SpellScriptLoader { -public: - spell_pal_blessing_of_faith() : SpellScriptLoader("spell_pal_blessing_of_faith") { } + public: + spell_pal_blessing_of_faith() : SpellScriptLoader("spell_pal_blessing_of_faith") { } - class spell_pal_blessing_of_faith_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pal_blessing_of_faith_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) + class spell_pal_blessing_of_faith_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_DRUID)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_PALADIN)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_PRIEST)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_SHAMAN)) - return false; - return true; - } + PrepareSpellScript(spell_pal_blessing_of_faith_SpellScript); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Unit* unitTarget = GetHitUnit()) + bool Validate(SpellInfo const* /*spellEntry*/) { - uint32 spell_id = 0; - switch (unitTarget->getClass()) + if (!sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_DRUID) || !sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_PALADIN) || !sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_PRIEST) || !sSpellMgr->GetSpellInfo(SPELL_BLESSING_OF_LOWER_CITY_SHAMAN)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* unitTarget = GetHitUnit()) { - case CLASS_DRUID: spell_id = SPELL_BLESSING_OF_LOWER_CITY_DRUID; break; - case CLASS_PALADIN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PALADIN; break; - case CLASS_PRIEST: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PRIEST; break; - case CLASS_SHAMAN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_SHAMAN; break; - default: return; // ignore for non-healing classes + uint32 spell_id = 0; + switch (unitTarget->getClass()) + { + case CLASS_DRUID: spell_id = SPELL_BLESSING_OF_LOWER_CITY_DRUID; break; + case CLASS_PALADIN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PALADIN; break; + case CLASS_PRIEST: spell_id = SPELL_BLESSING_OF_LOWER_CITY_PRIEST; break; + case CLASS_SHAMAN: spell_id = SPELL_BLESSING_OF_LOWER_CITY_SHAMAN; break; + default: return; // ignore for non-healing classes + } + Unit* caster = GetCaster(); + caster->CastSpell(caster, spell_id, true); } + } - GetCaster()->CastSpell(GetCaster(), spell_id, true); + void Register() + { + // add dummy effect spell handler to Blessing of Faith + OnEffectHitTarget += SpellEffectFn(spell_pal_blessing_of_faith_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - } + }; - void Register() + SpellScript* GetSpellScript() const { - // add dummy effect spell handler to Blessing of Faith - OnEffectHitTarget += SpellEffectFn(spell_pal_blessing_of_faith_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_pal_blessing_of_faith_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_pal_blessing_of_faith_SpellScript(); - } }; // 20911 Blessing of Sanctuary // 25899 Greater Blessing of Sanctuary class spell_pal_blessing_of_sanctuary : public SpellScriptLoader { -public: - spell_pal_blessing_of_sanctuary() : SpellScriptLoader("spell_pal_blessing_of_sanctuary") { } + public: + spell_pal_blessing_of_sanctuary() : SpellScriptLoader("spell_pal_blessing_of_sanctuary") { } - class spell_pal_blessing_of_sanctuary_AuraScript : public AuraScript - { - PrepareAuraScript(spell_pal_blessing_of_sanctuary_AuraScript) - bool Validate(SpellInfo const* /*entry*/) + class spell_pal_blessing_of_sanctuary_AuraScript : public AuraScript { - if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF)) - return false; - return true; - } + PrepareAuraScript(spell_pal_blessing_of_sanctuary_AuraScript); - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - if (Unit* pCaster = GetCaster()) - pCaster->CastSpell(target, PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, true); - } + bool Validate(SpellInfo const* /*entry*/) + { + if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF)) + return false; + return true; + } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - target->RemoveAura(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, GetCasterGUID()); - } + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + if (Unit* caster = GetCaster()) + caster->CastSpell(target, PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, true); + } + + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); + target->RemoveAura(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, GetCasterGUID()); + } - void Register() + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + AfterEffectRemove += AuraEffectRemoveFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } + }; + + AuraScript* GetAuraScript() const { - AfterEffectApply += AuraEffectApplyFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - AfterEffectRemove += AuraEffectRemoveFn(spell_pal_blessing_of_sanctuary_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + return new spell_pal_blessing_of_sanctuary_AuraScript(); } - }; - - AuraScript* GetAuraScript() const - { - return new spell_pal_blessing_of_sanctuary_AuraScript(); - } }; // 63521 Guarded by The Light class spell_pal_guarded_by_the_light : public SpellScriptLoader { -public: - spell_pal_guarded_by_the_light() : SpellScriptLoader("spell_pal_guarded_by_the_light") { } + public: + spell_pal_guarded_by_the_light() : SpellScriptLoader("spell_pal_guarded_by_the_light") { } - class spell_pal_guarded_by_the_light_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pal_guarded_by_the_light_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) + class spell_pal_guarded_by_the_light_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_DIVINE_PLEA)) - return false; - return true; - } + PrepareSpellScript(spell_pal_guarded_by_the_light_SpellScript); - void HandleScriptEffect(SpellEffIndex /*effIndex*/) - { - // Divine Plea - if (Aura* aura = GetCaster()->GetAura(PALADIN_SPELL_DIVINE_PLEA)) - aura->RefreshDuration(); - } + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_DIVINE_PLEA)) + return false; + return true; + } + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + // Divine Plea + if (Aura* aura = GetCaster()->GetAura(PALADIN_SPELL_DIVINE_PLEA)) + aura->RefreshDuration(); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_pal_guarded_by_the_light_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; - void Register() + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_pal_guarded_by_the_light_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + return new spell_pal_guarded_by_the_light_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_pal_guarded_by_the_light_SpellScript(); - } }; class spell_pal_holy_shock : public SpellScriptLoader { -public: - spell_pal_holy_shock() : SpellScriptLoader("spell_pal_holy_shock") { } + public: + spell_pal_holy_shock() : SpellScriptLoader("spell_pal_holy_shock") { } - class spell_pal_holy_shock_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pal_holy_shock_SpellScript) - bool Validate(SpellInfo const* spellEntry) + class spell_pal_holy_shock_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_HOLY_SHOCK_R1)) - return false; + PrepareSpellScript(spell_pal_holy_shock_SpellScript) + bool Validate(SpellInfo const* spellEntry) + { + if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_HOLY_SHOCK_R1)) + return false; - // can't use other spell than holy shock due to spell_ranks dependency - if (sSpellMgr->GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id)) - return false; + // can't use other spell than holy shock due to spell_ranks dependency + if (sSpellMgr->GetFirstSpellInChain(PALADIN_SPELL_HOLY_SHOCK_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id)) + return false; - uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id); - if (!sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true)) - return false; - if (!sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true)) - return false; + uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id); + if (!sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank, true) || !sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank, true)) + return false; - return true; - } + return true; + } - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Unit* unitTarget = GetHitUnit()) + void HandleDummy(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); + if (Unit* unitTarget = GetHitUnit()) + { + uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); + if (caster->IsFriendlyTo(unitTarget)) + caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank), true, 0); + else + caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank), true, 0); + } + } - uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); - - if (caster->IsFriendlyTo(unitTarget)) - caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_HEALING, rank), true, 0); - else - caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PALADIN_SPELL_HOLY_SHOCK_R1_DAMAGE, rank), true, 0); + void Register() + { + // add dummy effect spell handler to Holy Shock + OnEffectHitTarget += SpellEffectFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - } + }; - void Register() + SpellScript* GetSpellScript() const { - // add dummy effect spell handler to Holy Shock - OnEffectHitTarget += SpellEffectFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_pal_holy_shock_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_pal_holy_shock_SpellScript(); - } }; class spell_pal_judgement_of_command : public SpellScriptLoader { -public: - spell_pal_judgement_of_command() : SpellScriptLoader("spell_pal_judgement_of_command") { } + public: + spell_pal_judgement_of_command() : SpellScriptLoader("spell_pal_judgement_of_command") { } - class spell_pal_judgement_of_command_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pal_judgement_of_command_SpellScript) - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_pal_judgement_of_command_SpellScript : public SpellScript { - if (Unit* unitTarget = GetHitUnit()) - if (SpellInfo const* spell_proto = sSpellMgr->GetSpellInfo(GetEffectValue())) - GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL); - } + PrepareSpellScript(spell_pal_judgement_of_command_SpellScript) + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* unitTarget = GetHitUnit()) + if (SpellInfo const* spell_proto = sSpellMgr->GetSpellInfo(GetEffectValue())) + GetCaster()->CastSpell(unitTarget, spell_proto, true, NULL); + } + + void Register() + { + // add dummy effect spell handler to Judgement of Command + OnEffectHitTarget += SpellEffectFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - void Register() + SpellScript* GetSpellScript() const { - // add dummy effect spell handler to Judgement of Command - OnEffectHitTarget += SpellEffectFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_pal_judgement_of_command_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_pal_judgement_of_command_SpellScript(); - } }; class spell_pal_divine_storm : public SpellScriptLoader { -public: - spell_pal_divine_storm() : SpellScriptLoader("spell_pal_divine_storm") { } + public: + spell_pal_divine_storm() : SpellScriptLoader("spell_pal_divine_storm") { } + + class spell_pal_divine_storm_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pal_divine_storm_SpellScript); + + uint32 healPct; + + bool Validate(SpellInfo const* /* spell */) + { + if (!sSpellMgr->GetSpellInfo(SPELL_DIVINE_STORM_DUMMY)) + return false; + return true; + } - class spell_pal_divine_storm_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pal_divine_storm_SpellScript); + bool Load() + { + healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster()); + return true; + } - uint32 healPct; + void TriggerHeal() + { + Unit* caster = GetCaster(); + caster->CastCustomSpell(SPELL_DIVINE_STORM_DUMMY, SPELLVALUE_BASE_POINT0, (GetHitDamage() * healPct) / 100, caster, true); + } - bool Load() + void Register() + { + AfterHit += SpellHitFn(spell_pal_divine_storm_SpellScript::TriggerHeal); + } + }; + + SpellScript* GetSpellScript() const { - healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster()); - return true; + return new spell_pal_divine_storm_SpellScript(); } +}; - void TriggerHeal() +class spell_pal_divine_storm_dummy : public SpellScriptLoader +{ + public: + spell_pal_divine_storm_dummy() : SpellScriptLoader("spell_pal_divine_storm_dummy") { } + + class spell_pal_divine_storm_dummy_SpellScript : public SpellScript { - GetCaster()->CastCustomSpell(SPELL_DIVINE_STORM_DUMMY, SPELLVALUE_BASE_POINT0, (GetHitDamage() * healPct) / 100, GetCaster(), true); - } + PrepareSpellScript(spell_pal_divine_storm_dummy_SpellScript); - void Register() + bool Validate(SpellInfo const* /* spell */) + { + if (!sSpellMgr->GetSpellInfo(SPELL_DIVINE_STORM_HEAL)) + return false; + return true; + } + + void CountTargets(std::list& targetList) + { + _targetCount = targetList.size(); + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + if (!_targetCount || ! GetHitUnit()) + return; + + int32 heal = GetEffectValue() / _targetCount; + GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_DIVINE_STORM_HEAL, &heal, NULL, NULL, true); + } + private: + uint32 _targetCount; + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_pal_divine_storm_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnUnitTargetSelect += SpellUnitTargetFn(spell_pal_divine_storm_dummy_SpellScript::CountTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID); + } + }; + + SpellScript* GetSpellScript() const { - AfterHit += SpellHitFn(spell_pal_divine_storm_SpellScript::TriggerHeal); + return new spell_pal_divine_storm_dummy_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_pal_divine_storm_SpellScript(); - } }; void AddSC_paladin_spell_scripts() @@ -374,4 +421,5 @@ void AddSC_paladin_spell_scripts() new spell_pal_holy_shock(); new spell_pal_judgement_of_command(); new spell_pal_divine_storm(); + new spell_pal_divine_storm_dummy(); } diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index ee5f6a6d772..b7793c919b6 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -21,7 +21,6 @@ * Scriptnames of files in this file should be prefixed with "spell_pri_". */ -#include "ScriptPCH.h" #include "SpellAuraEffects.h" #include "GridNotifiers.h" @@ -49,7 +48,9 @@ class spell_pri_guardian_spirit : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - return sSpellMgr->GetSpellInfo(PRIEST_SPELL_GUARDIAN_SPIRIT_HEAL) != NULL; + if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_GUARDIAN_SPIRIT_HEAL)) + return false; + return true; } bool Load() @@ -101,11 +102,8 @@ class spell_pri_mana_burn : public SpellScriptLoader void HandleAfterHit() { - Unit* unitTarget = GetHitUnit(); - if (!unitTarget) - return; - - unitTarget->RemoveAurasWithMechanic((1 << MECHANIC_FEAR) | (1 << MECHANIC_POLYMORPH)); + if (Unit* unitTarget = GetHitUnit()) + unitTarget->RemoveAurasWithMechanic((1 << MECHANIC_FEAR) | (1 << MECHANIC_POLYMORPH)); } void Register() @@ -204,18 +202,19 @@ class spell_pri_penance : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - Unit* unitTarget = GetHitUnit(); - if (!unitTarget || !unitTarget->isAlive()) - return; - Unit* caster = GetCaster(); + if (Unit* unitTarget = GetHitUnit()) + { + if(!unitTarget->isAlive()) + return; - uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); + uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); - if (caster->IsFriendlyTo(unitTarget)) - caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank), false, 0); - else - caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank), false, 0); + if (caster->IsFriendlyTo(unitTarget)) + caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank), false, 0); + else + caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank), false, 0); + } } void Register() @@ -243,7 +242,9 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - return sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED) && sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_R1); + if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED) || !sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_R1)) + return false; + return true; } void Trigger(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) @@ -251,14 +252,13 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader Unit* target = GetTarget(); if (dmgInfo.GetAttacker() == target) return; - Unit* caster = GetCaster(); - if (!caster) - return; - if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0)) - { - int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount()); - target->CastCustomSpell(dmgInfo.GetAttacker(), PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); - } + + if (Unit* caster = GetCaster()) + if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0)) + { + int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount()); + target->CastCustomSpell(dmgInfo.GetAttacker(), PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); + } } void Register() diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 940e494f18f..9b5e2b2ea09 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -21,48 +21,47 @@ * Scriptnames of files in this file should be prefixed with "spell_q#questID_". */ -#include "ScriptPCH.h" #include "Vehicle.h" class spell_generic_quest_update_entry_SpellScript : public SpellScript { - PrepareSpellScript(spell_generic_quest_update_entry_SpellScript) -private: - uint16 _spellEffect; - uint8 _effIndex; - uint32 _originalEntry; - uint32 _newEntry; - bool _shouldAttack; - uint32 _despawnTime; - -public: - spell_generic_quest_update_entry_SpellScript(uint16 spellEffect, uint8 effIndex, uint32 originalEntry, uint32 newEntry, bool shouldAttack, uint32 despawnTime = 0) : - SpellScript(), _spellEffect(spellEffect), _effIndex(effIndex), _originalEntry(originalEntry), - _newEntry(newEntry), _shouldAttack(shouldAttack), _despawnTime(despawnTime) { } - - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Creature* creatureTarget = GetHitCreature()) - if (!creatureTarget->isPet() && creatureTarget->GetEntry() == _originalEntry) - { - creatureTarget->UpdateEntry(_newEntry); - if (_shouldAttack && creatureTarget->IsAIEnabled) - creatureTarget->AI()->AttackStart(GetCaster()); + PrepareSpellScript(spell_generic_quest_update_entry_SpellScript); + private: + uint16 _spellEffect; + uint8 _effIndex; + uint32 _originalEntry; + uint32 _newEntry; + bool _shouldAttack; + uint32 _despawnTime; - if (_despawnTime) - creatureTarget->DespawnOrUnsummon(_despawnTime); - } - } + public: + spell_generic_quest_update_entry_SpellScript(uint16 spellEffect, uint8 effIndex, uint32 originalEntry, uint32 newEntry, bool shouldAttack, uint32 despawnTime = 0) : + SpellScript(), _spellEffect(spellEffect), _effIndex(effIndex), _originalEntry(originalEntry), + _newEntry(newEntry), _shouldAttack(shouldAttack), _despawnTime(despawnTime) { } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Creature* creatureTarget = GetHitCreature()) + if (!creatureTarget->isPet() && creatureTarget->GetEntry() == _originalEntry) + { + creatureTarget->UpdateEntry(_newEntry); + if (_shouldAttack && creatureTarget->IsAIEnabled) + creatureTarget->AI()->AttackStart(GetCaster()); + + if (_despawnTime) + creatureTarget->DespawnOrUnsummon(_despawnTime); + } + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_generic_quest_update_entry_SpellScript::HandleDummy, _effIndex, _spellEffect); - } + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_generic_quest_update_entry_SpellScript::HandleDummy, _effIndex, _spellEffect); + } }; // http://www.wowhead.com/quest=55 Morbent Fel // 8913 Sacred Cleansing -enum eQuest55Data +enum Quest55Data { NPC_MORBENT = 1200, NPC_WEAKENED_MORBENT = 24782, @@ -70,18 +69,18 @@ enum eQuest55Data class spell_q55_sacred_cleansing : public SpellScriptLoader { -public: - spell_q55_sacred_cleansing() : SpellScriptLoader("spell_q55_sacred_cleansing") { } + public: + spell_q55_sacred_cleansing() : SpellScriptLoader("spell_q55_sacred_cleansing") { } - SpellScript* GetSpellScript() const - { - return new spell_generic_quest_update_entry_SpellScript(SPELL_EFFECT_DUMMY, EFFECT_1, NPC_MORBENT, NPC_WEAKENED_MORBENT, true); - } + SpellScript* GetSpellScript() const + { + return new spell_generic_quest_update_entry_SpellScript(SPELL_EFFECT_DUMMY, EFFECT_1, NPC_MORBENT, NPC_WEAKENED_MORBENT, true); + } }; // http://www.wowhead.com/quest=5206 Marauders of Darrowshire // 17271 Test Fetid Skull -enum eQuest5206Data +enum Quest5206Data { SPELL_CREATE_RESONATING_SKULL = 17269, SPELL_CREATE_BONE_DUST = 17270 @@ -89,47 +88,48 @@ enum eQuest5206Data class spell_q5206_test_fetid_skull : public SpellScriptLoader { -public: - spell_q5206_test_fetid_skull() : SpellScriptLoader("spell_q5206_test_fetid_skull") { } + public: + spell_q5206_test_fetid_skull() : SpellScriptLoader("spell_q5206_test_fetid_skull") { } - class spell_q5206_test_fetid_skull_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q5206_test_fetid_skull_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) + class spell_q5206_test_fetid_skull_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_RESONATING_SKULL)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_BONE_DUST)) - return false; - return true; - } + PrepareSpellScript(spell_q5206_test_fetid_skull_SpellScript); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* pCaster = GetCaster(); - if (pCaster->GetTypeId() == TYPEID_PLAYER) + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_CREATE_RESONATING_SKULL) || !sSpellMgr->GetSpellInfo(SPELL_CREATE_BONE_DUST)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) { + Unit* caster = GetCaster(); uint32 spellId = roll_chance_i(50) ? SPELL_CREATE_RESONATING_SKULL : SPELL_CREATE_BONE_DUST; - pCaster->CastSpell(pCaster, spellId, true, NULL); + caster->CastSpell(caster, spellId, true, NULL); } - } - void Register() + void Register() + { + OnEffectHit += SpellEffectFn(spell_q5206_test_fetid_skull_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHit += SpellEffectFn(spell_q5206_test_fetid_skull_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_q5206_test_fetid_skull_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_q5206_test_fetid_skull_SpellScript(); - } }; // http://www.wowhead.com/quest=6124 Curing the Sick (A) // http://www.wowhead.com/quest=6129 Curing the Sick (H) // 19512 Apply Salve -enum eQuests6124_6129Data +enum Quests6124_6129Data { NPC_SICKLY_GAZELLE = 12296, NPC_CURED_GAZELLE = 12297, @@ -140,20 +140,26 @@ enum eQuests6124_6129Data class spell_q6124_6129_apply_salve : public SpellScriptLoader { -public: - spell_q6124_6129_apply_salve() : SpellScriptLoader("spell_q6124_6129_apply_salve") { } + public: + spell_q6124_6129_apply_salve() : SpellScriptLoader("spell_q6124_6129_apply_salve") { } - class spell_q6124_6129_apply_salve_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q6124_6129_apply_salve_SpellScript) - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_q6124_6129_apply_salve_SpellScript : public SpellScript { - if (GetCastItem()) - if (Player* pCaster = GetCaster()->ToPlayer()) + PrepareSpellScript(spell_q6124_6129_apply_salve_SpellScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + if (GetCastItem()) if (Creature* creatureTarget = GetHitCreature()) { uint32 uiNewEntry = 0; - switch (pCaster->GetTeam()) + switch (caster->GetTeam()) { case HORDE: if (creatureTarget->GetEntry() == NPC_SICKLY_GAZELLE) @@ -170,23 +176,23 @@ public: creatureTarget->DespawnOrUnsummon(DESPAWN_TIME); } } - } + } - void Register() + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q6124_6129_apply_salve_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_q6124_6129_apply_salve_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_q6124_6129_apply_salve_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_q6124_6129_apply_salve_SpellScript(); - } }; // http://www.wowhead.com/quest=10255 Testing the Antidote // 34665 Administer Antidote -enum eQuest10255Data +enum Quest10255Data { NPC_HELBOAR = 16880, NPC_DREADTUSK = 16992, @@ -194,18 +200,18 @@ enum eQuest10255Data class spell_q10255_administer_antidote : public SpellScriptLoader { -public: - spell_q10255_administer_antidote() : SpellScriptLoader("spell_q10255_administer_antidote") { } + public: + spell_q10255_administer_antidote() : SpellScriptLoader("spell_q10255_administer_antidote") { } - SpellScript* GetSpellScript() const - { - return new spell_generic_quest_update_entry_SpellScript(SPELL_EFFECT_DUMMY, EFFECT_0, NPC_HELBOAR, NPC_DREADTUSK, true); - } + SpellScript* GetSpellScript() const + { + return new spell_generic_quest_update_entry_SpellScript(SPELL_EFFECT_DUMMY, EFFECT_0, NPC_HELBOAR, NPC_DREADTUSK, true); + } }; // http://www.wowhead.com/quest=11396 Bring Down Those Shields (A) // http://www.wowhead.com/quest=11399 Bring Down Those Shields (H) -enum eQuest11396_11399Data +enum Quest11396_11399Data { SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3 = 43874, SPELL_SCOURGING_CRYSTAL_CONTROLLER = 43878 @@ -214,115 +220,116 @@ enum eQuest11396_11399Data // 43874 Scourge Mur'gul Camp: Force Shield Arcane Purple x3 class spell_q11396_11399_force_shield_arcane_purple_x3 : public SpellScriptLoader { -public: - spell_q11396_11399_force_shield_arcane_purple_x3() : SpellScriptLoader("spell_q11396_11399_force_shield_arcane_purple_x3") { } + public: + spell_q11396_11399_force_shield_arcane_purple_x3() : SpellScriptLoader("spell_q11396_11399_force_shield_arcane_purple_x3") { } - class spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript : public AuraScript - { - PrepareAuraScript(spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript) - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + class spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript : public AuraScript { - Unit* target = GetTarget(); + PrepareAuraScript(spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript); + + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* target = GetTarget(); target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); target->AddUnitState(UNIT_STATE_ROOT); - } + } - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - } + } - void Register() - { - OnEffectApply += AuraEffectApplyFn(spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - OnEffectRemove += AuraEffectRemoveFn(spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } - }; + }; - AuraScript* GetAuraScript() const - { - return new spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript(); + } }; // 50133 Scourging Crystal Controller class spell_q11396_11399_scourging_crystal_controller : public SpellScriptLoader { -public: - spell_q11396_11399_scourging_crystal_controller() : SpellScriptLoader("spell_q11396_11399_scourging_crystal_controller") { } + public: + spell_q11396_11399_scourging_crystal_controller() : SpellScriptLoader("spell_q11396_11399_scourging_crystal_controller") { } - class spell_q11396_11399_scourging_crystal_controller_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q11396_11399_scourging_crystal_controller_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) + class spell_q11396_11399_scourging_crystal_controller_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SCOURGING_CRYSTAL_CONTROLLER)) - return false; - return true; - } + PrepareSpellScript(spell_q11396_11399_scourging_crystal_controller_SpellScript); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Unit* target = GetTargetUnit()) - if (target->GetTypeId() == TYPEID_UNIT && target->HasAura(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3)) - // Make sure nobody else is channeling the same target - if (!target->HasAura(SPELL_SCOURGING_CRYSTAL_CONTROLLER)) - GetCaster()->CastSpell(target, SPELL_SCOURGING_CRYSTAL_CONTROLLER, true, GetCastItem()); - } + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3) || !sSpellMgr->GetSpellInfo(SPELL_SCOURGING_CRYSTAL_CONTROLLER)) + return false; + return true; + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_q11396_11399_scourging_crystal_controller_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetTargetUnit()) + if (target->GetTypeId() == TYPEID_UNIT && target->HasAura(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3)) + // Make sure nobody else is channeling the same target + if (!target->HasAura(SPELL_SCOURGING_CRYSTAL_CONTROLLER)) + GetCaster()->CastSpell(target, SPELL_SCOURGING_CRYSTAL_CONTROLLER, true, GetCastItem()); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q11396_11399_scourging_crystal_controller_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_q11396_11399_scourging_crystal_controller_SpellScript(); - }; + SpellScript* GetSpellScript() const + { + return new spell_q11396_11399_scourging_crystal_controller_SpellScript(); + }; }; // 43882 Scourging Crystal Controller Dummy class spell_q11396_11399_scourging_crystal_controller_dummy : public SpellScriptLoader { -public: - spell_q11396_11399_scourging_crystal_controller_dummy() : SpellScriptLoader("spell_q11396_11399_scourging_crystal_controller_dummy") { } + public: + spell_q11396_11399_scourging_crystal_controller_dummy() : SpellScriptLoader("spell_q11396_11399_scourging_crystal_controller_dummy") { } - class spell_q11396_11399_scourging_crystal_controller_dummy_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q11396_11399_scourging_crystal_controller_dummy_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) + class spell_q11396_11399_scourging_crystal_controller_dummy_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3)) - return false; - return true; - } + PrepareSpellScript(spell_q11396_11399_scourging_crystal_controller_dummy_SpellScript); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - if (Unit* target = GetTargetUnit()) - if (target->GetTypeId() == TYPEID_UNIT) - target->RemoveAurasDueToSpell(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3); - } + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3)) + return false; + return true; + } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_q11396_11399_scourging_crystal_controller_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* target = GetHitUnit()) + if (target->GetTypeId() == TYPEID_UNIT) + target->RemoveAurasDueToSpell(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q11396_11399_scourging_crystal_controller_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_q11396_11399_scourging_crystal_controller_dummy_SpellScript(); - }; + SpellScript* GetSpellScript() const + { + return new spell_q11396_11399_scourging_crystal_controller_dummy_SpellScript(); + }; }; // http://www.wowhead.com/quest=11515 Blood for Blood // 44936 Quest - Fel Siphon Dummy -enum eQuest11515Data +enum Quest11515Data { NPC_FELBLOOD_INITIATE = 24918, NPC_EMACIATED_FELBLOOD = 24955 @@ -330,18 +337,18 @@ enum eQuest11515Data class spell_q11515_fel_siphon_dummy : public SpellScriptLoader { -public: - spell_q11515_fel_siphon_dummy() : SpellScriptLoader("spell_q11515_fel_siphon_dummy") { } + public: + spell_q11515_fel_siphon_dummy() : SpellScriptLoader("spell_q11515_fel_siphon_dummy") { } - SpellScript* GetSpellScript() const - { - return new spell_generic_quest_update_entry_SpellScript(SPELL_EFFECT_DUMMY, EFFECT_0, NPC_FELBLOOD_INITIATE, NPC_EMACIATED_FELBLOOD, true); - } + SpellScript* GetSpellScript() const + { + return new spell_generic_quest_update_entry_SpellScript(SPELL_EFFECT_DUMMY, EFFECT_0, NPC_FELBLOOD_INITIATE, NPC_EMACIATED_FELBLOOD, true); + } }; // http://www.wowhead.com/quest=11587 Prison Break // 45449 Arcane Prisoner Rescue -enum eQuest11587Data +enum Quest11587Data { SPELL_SUMMON_ARCANE_PRISONER_MALE = 45446, // Summon Arcane Prisoner - Male SPELL_SUMMON_ARCANE_PRISONER_FEMALE = 45448, // Summon Arcane Prisoner - Female @@ -350,51 +357,48 @@ enum eQuest11587Data class spell_q11587_arcane_prisoner_rescue : public SpellScriptLoader { -public: - spell_q11587_arcane_prisoner_rescue() : SpellScriptLoader("spell_q11587_arcane_prisoner_rescue") { } + public: + spell_q11587_arcane_prisoner_rescue() : SpellScriptLoader("spell_q11587_arcane_prisoner_rescue") { } - class spell_q11587_arcane_prisoner_rescue_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q11587_arcane_prisoner_rescue_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) + class spell_q11587_arcane_prisoner_rescue_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ARCANE_PRISONER_MALE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ARCANE_PRISONER_FEMALE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_ARCANE_PRISONER_KILL_CREDIT)) - return false; - return true; - } + PrepareSpellScript(spell_q11587_arcane_prisoner_rescue_SpellScript); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Unit* caster = GetCaster(); - if (Unit* unitTarget = GetHitUnit()) + bool Validate(SpellInfo const* /*spellEntry*/) { - uint32 spellId = SPELL_SUMMON_ARCANE_PRISONER_MALE; - if (rand() % 2) - spellId = SPELL_SUMMON_ARCANE_PRISONER_FEMALE; - caster->CastSpell(caster, spellId, true); - unitTarget->CastSpell(caster, SPELL_ARCANE_PRISONER_KILL_CREDIT, true); + if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ARCANE_PRISONER_MALE) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_ARCANE_PRISONER_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_ARCANE_PRISONER_KILL_CREDIT)) + return false; + return true; } - } - void Register() + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Unit* unitTarget = GetHitUnit()) + { + uint32 spellId = SPELL_SUMMON_ARCANE_PRISONER_MALE; + if (rand() % 2) + spellId = SPELL_SUMMON_ARCANE_PRISONER_FEMALE; + caster->CastSpell(caster, spellId, true); + unitTarget->CastSpell(caster, SPELL_ARCANE_PRISONER_KILL_CREDIT, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q11587_arcane_prisoner_rescue_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_q11587_arcane_prisoner_rescue_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_q11587_arcane_prisoner_rescue_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_q11587_arcane_prisoner_rescue_SpellScript(); - } }; // http://www.wowhead.com/quest=11730 Master and Servant // 46023 The Ultrasonic Screwdriver -enum eQuest11730Data +enum Quest11730Data { SPELL_SUMMON_SCAVENGEBOT_004A8 = 46063, SPELL_SUMMON_SENTRYBOT_57K = 46068, @@ -411,74 +415,63 @@ enum eQuest11730Data class spell_q11730_ultrasonic_screwdriver : public SpellScriptLoader { -public: - spell_q11730_ultrasonic_screwdriver() : SpellScriptLoader("spell_q11730_ultrasonic_screwdriver") { } + public: + spell_q11730_ultrasonic_screwdriver() : SpellScriptLoader("spell_q11730_ultrasonic_screwdriver") { } - class spell_q11730_ultrasonic_screwdriver_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q11730_ultrasonic_screwdriver_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) + class spell_q11730_ultrasonic_screwdriver_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SCAVENGEBOT_004A8)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SENTRYBOT_57K)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_DEFENDOTANK_66D)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SCAVENGEBOT_005B6)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_55D_COLLECTATRON)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_ROBOT_KILL_CREDIT)) - return false; - return true; - } + PrepareSpellScript(spell_q11730_ultrasonic_screwdriver_SpellScript); - void HandleDummy(SpellEffIndex /*effIndex*/) - { - Item* castItem = GetCastItem(); - if (!castItem) - return; + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem(); + } - Unit* pCaster = GetCaster(); - if (pCaster->GetTypeId() != TYPEID_PLAYER) - return; + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_SCAVENGEBOT_004A8) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_SENTRYBOT_57K) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_DEFENDOTANK_66D) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_SCAVENGEBOT_005B6) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_55D_COLLECTATRON) || !sSpellMgr->GetSpellInfo(SPELL_ROBOT_KILL_CREDIT)) + return false; + return true; + } - Creature* target = GetHitCreature(); - if (!target) - return; + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Item* castItem = GetCastItem(); + Unit* caster = GetCaster(); + if (Creature* target = GetHitCreature()) + { + uint32 spellId = 0; + switch (target->GetEntry()) + { + case NPC_SCAVENGEBOT_004A8: spellId = SPELL_SUMMON_SCAVENGEBOT_004A8; break; + case NPC_SENTRYBOT_57K: spellId = SPELL_SUMMON_SENTRYBOT_57K; break; + case NPC_DEFENDOTANK_66D: spellId = SPELL_SUMMON_DEFENDOTANK_66D; break; + case NPC_SCAVENGEBOT_005B6: spellId = SPELL_SUMMON_SCAVENGEBOT_005B6; break; + case NPC_55D_COLLECTATRON: spellId = SPELL_SUMMON_55D_COLLECTATRON; break; + default: + return; + } + caster->CastSpell(caster, spellId, true, castItem); + caster->CastSpell(caster, SPELL_ROBOT_KILL_CREDIT, true); + target->DespawnOrUnsummon(); + } + } - uint32 spellId = 0; - switch (target->GetEntry()) + void Register() { - case NPC_SCAVENGEBOT_004A8: spellId = SPELL_SUMMON_SCAVENGEBOT_004A8; break; - case NPC_SENTRYBOT_57K: spellId = SPELL_SUMMON_SENTRYBOT_57K; break; - case NPC_DEFENDOTANK_66D: spellId = SPELL_SUMMON_DEFENDOTANK_66D; break; - case NPC_SCAVENGEBOT_005B6: spellId = SPELL_SUMMON_SCAVENGEBOT_005B6; break; - case NPC_55D_COLLECTATRON: spellId = SPELL_SUMMON_55D_COLLECTATRON; break; - default: - return; + OnEffectHitTarget += SpellEffectFn(spell_q11730_ultrasonic_screwdriver_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - pCaster->CastSpell(pCaster, spellId, true, castItem); - pCaster->CastSpell(pCaster, SPELL_ROBOT_KILL_CREDIT, true); - target->DespawnOrUnsummon(); - } + }; - void Register() + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_q11730_ultrasonic_screwdriver_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_q11730_ultrasonic_screwdriver_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_q11730_ultrasonic_screwdriver_SpellScript(); - } }; // http://www.wowhead.com/quest=12459 That Which Creates Can Also Destroy // 49587 Seeds of Nature's Wrath -enum eQuest12459Data +enum Quest12459Data { NPC_REANIMATED_FROSTWYRM = 26841, NPC_WEAK_REANIMATED_FROSTWYRM = 27821, @@ -492,44 +485,44 @@ enum eQuest12459Data class spell_q12459_seeds_of_natures_wrath : public SpellScriptLoader { -public: - spell_q12459_seeds_of_natures_wrath() : SpellScriptLoader("spell_q12459_seeds_of_natures_wrath") { } - - class spell_q12459_seeds_of_natures_wrath_SpellScript : public SpellScript - { public: - PrepareSpellScript(spell_q12459_seeds_of_natures_wrath_SpellScript) - void HandleDummy(SpellEffIndex /*effIndex*/) + spell_q12459_seeds_of_natures_wrath() : SpellScriptLoader("spell_q12459_seeds_of_natures_wrath") { } + + class spell_q12459_seeds_of_natures_wrath_SpellScript : public SpellScript { - if (Creature* creatureTarget = GetHitCreature()) + PrepareSpellScript(spell_q12459_seeds_of_natures_wrath_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) { - uint32 uiNewEntry = 0; - switch (creatureTarget->GetEntry()) + if (Creature* creatureTarget = GetHitCreature()) { - case NPC_REANIMATED_FROSTWYRM: uiNewEntry = NPC_WEAK_REANIMATED_FROSTWYRM; break; - case NPC_TURGID: uiNewEntry = NPC_WEAK_TURGID; break; - case NPC_DEATHGAZE: uiNewEntry = NPC_WEAK_DEATHGAZE; break; + uint32 uiNewEntry = 0; + switch (creatureTarget->GetEntry()) + { + case NPC_REANIMATED_FROSTWYRM: uiNewEntry = NPC_WEAK_REANIMATED_FROSTWYRM; break; + case NPC_TURGID: uiNewEntry = NPC_WEAK_TURGID; break; + case NPC_DEATHGAZE: uiNewEntry = NPC_WEAK_DEATHGAZE; break; + } + if (uiNewEntry) + creatureTarget->UpdateEntry(uiNewEntry); } - if (uiNewEntry) - creatureTarget->UpdateEntry(uiNewEntry); } - } - void Register() + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q12459_seeds_of_natures_wrath_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_q12459_seeds_of_natures_wrath_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_q12459_seeds_of_natures_wrath_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_q12459_seeds_of_natures_wrath_SpellScript(); - } }; // http://www.wowhead.com/quest=12634 Some Make Lemonade, Some Make Liquor // 51840 Despawn Fruit Tosser -enum eQuest12634Data +enum Quest12634Data { SPELL_BANANAS_FALL_TO_GROUND = 51836, SPELL_ORANGE_FALLS_TO_GROUND = 51837, @@ -539,90 +532,84 @@ enum eQuest12634Data class spell_q12634_despawn_fruit_tosser : public SpellScriptLoader { -public: - spell_q12634_despawn_fruit_tosser() : SpellScriptLoader("spell_q12634_despawn_fruit_tosser") { } - - class spell_q12634_despawn_fruit_tosser_SpellScript : public SpellScript - { public: - PrepareSpellScript(spell_q12634_despawn_fruit_tosser_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_BANANAS_FALL_TO_GROUND)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_ORANGE_FALLS_TO_GROUND)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_PAPAYA_FALLS_TO_GROUND)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_ADVENTUROUS_DWARF)) - return false; - return true; - } + spell_q12634_despawn_fruit_tosser() : SpellScriptLoader("spell_q12634_despawn_fruit_tosser") { } - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_q12634_despawn_fruit_tosser_SpellScript : public SpellScript { - uint32 spellId = SPELL_BANANAS_FALL_TO_GROUND; - switch (urand(0, 3)) + PrepareSpellScript(spell_q12634_despawn_fruit_tosser_SpellScript); + + bool Validate(SpellInfo const* /*spellEntry*/) { - case 1: spellId = SPELL_ORANGE_FALLS_TO_GROUND; break; - case 2: spellId = SPELL_PAPAYA_FALLS_TO_GROUND; break; + if (!sSpellMgr->GetSpellInfo(SPELL_BANANAS_FALL_TO_GROUND) || !sSpellMgr->GetSpellInfo(SPELL_ORANGE_FALLS_TO_GROUND) || !sSpellMgr->GetSpellInfo(SPELL_PAPAYA_FALLS_TO_GROUND) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_ADVENTUROUS_DWARF)) + return false; + return true; } - // sometimes, if you're lucky, you get a dwarf - if (roll_chance_i(5)) - spellId = SPELL_SUMMON_ADVENTUROUS_DWARF; - GetCaster()->CastSpell(GetCaster(), spellId, true, NULL); - } - void Register() + void HandleDummy(SpellEffIndex /*effIndex*/) + { + uint32 spellId = SPELL_BANANAS_FALL_TO_GROUND; + switch (urand(0, 3)) + { + case 1: spellId = SPELL_ORANGE_FALLS_TO_GROUND; break; + case 2: spellId = SPELL_PAPAYA_FALLS_TO_GROUND; break; + } + // sometimes, if you're lucky, you get a dwarf + if (roll_chance_i(5)) + spellId = SPELL_SUMMON_ADVENTUROUS_DWARF; + GetCaster()->CastSpell(GetCaster(), spellId, true, NULL); + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_q12634_despawn_fruit_tosser_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHit += SpellEffectFn(spell_q12634_despawn_fruit_tosser_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_q12634_despawn_fruit_tosser_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_q12634_despawn_fruit_tosser_SpellScript(); - } }; // http://www.wowhead.com/quest=12683 Burning to Help // 52308 Take Sputum Sample class spell_q12683_take_sputum_sample : public SpellScriptLoader { -public: - spell_q12683_take_sputum_sample() : SpellScriptLoader("spell_q12683_take_sputum_sample") { } - - class spell_q12683_take_sputum_sample_SpellScript : public SpellScript - { public: - PrepareSpellScript(spell_q12683_take_sputum_sample_SpellScript) - void HandleDummy(SpellEffIndex /*effIndex*/) + spell_q12683_take_sputum_sample() : SpellScriptLoader("spell_q12683_take_sputum_sample") { } + + class spell_q12683_take_sputum_sample_SpellScript : public SpellScript { - uint32 reqAuraId = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + PrepareSpellScript(spell_q12683_take_sputum_sample_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + uint32 reqAuraId = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + + Unit* caster = GetCaster(); + if (caster->HasAuraEffect(reqAuraId, 0)) + { + uint32 spellId = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); + caster->CastSpell(caster, spellId, true, NULL); + } + } - Unit* pCaster = GetCaster(); - if (pCaster->HasAuraEffect(reqAuraId, 0)) + void Register() { - uint32 spellId = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); - pCaster->CastSpell(pCaster, spellId, true, NULL); + OnEffectHit += SpellEffectFn(spell_q12683_take_sputum_sample_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - } + }; - void Register() + SpellScript* GetSpellScript() const { - OnEffectHit += SpellEffectFn(spell_q12683_take_sputum_sample_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_q12683_take_sputum_sample_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_q12683_take_sputum_sample_SpellScript(); - } }; // http://www.wowhead.com/quest=12851 Going Bearback // 54798 FLAMING Arrow Triggered Effect -enum eQuest12851Data +enum Quest12851Data { NPC_FROSTGIANT = 29351, NPC_FROSTWORG = 29358, @@ -634,53 +621,53 @@ enum eQuest12851Data class spell_q12851_going_bearback : public SpellScriptLoader { -public: - spell_q12851_going_bearback() : SpellScriptLoader("spell_q12851_going_bearback") { } - - class spell_q12851_going_bearback_AuraScript : public AuraScript - { public: - PrepareAuraScript(spell_q12851_going_bearback_AuraScript) - void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + spell_q12851_going_bearback() : SpellScriptLoader("spell_q12851_going_bearback") { } + + class spell_q12851_going_bearback_AuraScript : public AuraScript { - if (Unit* caster = GetCaster()) + PrepareAuraScript(spell_q12851_going_bearback_AuraScript); + + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* target = GetTarget(); - if (Player* player = caster->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (Unit* caster = GetCaster()) { - switch (target->GetEntry()) + Unit* target = GetTarget(); + if (Player* player = caster->GetCharmerOrOwnerPlayerOrPlayerItself()) { - case NPC_FROSTWORG: - target->CastSpell(player, SPELL_FROSTWORG_CREDIT, true); - target->CastSpell(target, SPELL_IMMOLATION, true); - target->CastSpell(target, SPELL_ABLAZE, true); - break; - case NPC_FROSTGIANT: - target->CastSpell(player, SPELL_FROSTGIANT_CREDIT, true); - target->CastSpell(target, SPELL_IMMOLATION, true); - target->CastSpell(target, SPELL_ABLAZE, true); - break; + switch (target->GetEntry()) + { + case NPC_FROSTWORG: + target->CastSpell(player, SPELL_FROSTWORG_CREDIT, true); + target->CastSpell(target, SPELL_IMMOLATION, true); + target->CastSpell(target, SPELL_ABLAZE, true); + break; + case NPC_FROSTGIANT: + target->CastSpell(player, SPELL_FROSTGIANT_CREDIT, true); + target->CastSpell(target, SPELL_IMMOLATION, true); + target->CastSpell(target, SPELL_ABLAZE, true); + break; + } } } } - } - void Register() - { - AfterEffectApply += AuraEffectApplyFn(spell_q12851_going_bearback_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); - } + void Register() + { + AfterEffectApply += AuraEffectApplyFn(spell_q12851_going_bearback_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + } - }; + }; - AuraScript* GetAuraScript() const - { - return new spell_q12851_going_bearback_AuraScript(); - } + AuraScript* GetAuraScript() const + { + return new spell_q12851_going_bearback_AuraScript(); + } }; // http://www.wowhead.com/quest=12937 Relief for the Fallen // 55804 Healing Finished -enum eQuest12937Data +enum Quest12937Data { SPELL_TRIGGER_AID_OF_THE_EARTHEN = 55809, NPC_FALLEN_EARTHEN_DEFENDER = 30035, @@ -688,50 +675,50 @@ enum eQuest12937Data class spell_q12937_relief_for_the_fallen : public SpellScriptLoader { -public: - spell_q12937_relief_for_the_fallen() : SpellScriptLoader("spell_q12937_relief_for_the_fallen") { } - - class spell_q12937_relief_for_the_fallen_SpellScript : public SpellScript - { public: - PrepareSpellScript(spell_q12937_relief_for_the_fallen_SpellScript) - bool Validate(SpellInfo const* /*spellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(SPELL_TRIGGER_AID_OF_THE_EARTHEN)) - return false; - return true; - } + spell_q12937_relief_for_the_fallen() : SpellScriptLoader("spell_q12937_relief_for_the_fallen") { } - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_q12937_relief_for_the_fallen_SpellScript : public SpellScript { - Unit* pCaster = GetCaster(); - if (Player* player = pCaster->ToPlayer()) + PrepareSpellScript(spell_q12937_relief_for_the_fallen_SpellScript); + + bool Load() { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_TRIGGER_AID_OF_THE_EARTHEN)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); if (Creature* target = GetHitCreature()) { - player->CastSpell(player, SPELL_TRIGGER_AID_OF_THE_EARTHEN, true, NULL); - player->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER, 0); + caster->CastSpell(caster, SPELL_TRIGGER_AID_OF_THE_EARTHEN, true, NULL); + caster->KilledMonsterCredit(NPC_FALLEN_EARTHEN_DEFENDER, 0); target->DespawnOrUnsummon(); } } - } - void Register() + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q12937_relief_for_the_fallen_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_q12937_relief_for_the_fallen_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_q12937_relief_for_the_fallen_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_q12937_relief_for_the_fallen_SpellScript(); - } }; -enum eWhoarethey +enum Whoarethey { - SPELL_QUESTGIVER = 48917, - SPELL_MALE_DISGUISE = 38080, SPELL_FEMALE_DISGUISE = 38081, SPELL_GENERIC_DISGUISE = 32756 @@ -748,7 +735,7 @@ class spell_q10041_q10040_who_are_they : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_QUESTGIVER)) + if (!sSpellMgr->GetSpellInfo(SPELL_MALE_DISGUISE) || !sSpellMgr->GetSpellInfo(SPELL_FEMALE_DISGUISE) || !sSpellMgr->GetSpellInfo(SPELL_GENERIC_DISGUISE)) return false; return true; } @@ -756,11 +743,11 @@ class spell_q10041_q10040_who_are_they : public SpellScriptLoader void HandleScript(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - if (!GetHitUnit() || !GetHitUnit()->ToPlayer()) - return; - - GetHitUnit()->CastSpell(GetHitUnit(), GetHitUnit()->getGender() == GENDER_MALE ? SPELL_MALE_DISGUISE : SPELL_FEMALE_DISGUISE, true); - GetHitUnit()->CastSpell(GetHitUnit(), SPELL_GENERIC_DISGUISE, true); + if (Player* target = GetHitPlayer()) + { + target->CastSpell(target, target->getGender() == GENDER_MALE ? SPELL_MALE_DISGUISE : SPELL_FEMALE_DISGUISE, true); + target->CastSpell(target, SPELL_GENERIC_DISGUISE, true); + } } void Register() @@ -783,79 +770,81 @@ enum symboloflife // 8593 Symbol of life dummy class spell_symbol_of_life_dummy : public SpellScriptLoader { -public: - spell_symbol_of_life_dummy() : SpellScriptLoader("spell_symbol_of_life_dummy") { } - - class spell_symbol_of_life_dummy_SpellScript : public SpellScript - { - PrepareSpellScript(spell_symbol_of_life_dummy_SpellScript); + public: + spell_symbol_of_life_dummy() : SpellScriptLoader("spell_symbol_of_life_dummy") { } - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_symbol_of_life_dummy_SpellScript : public SpellScript { - if (Creature* target = GetHitCreature()) + PrepareSpellScript(spell_symbol_of_life_dummy_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) { - if (target->HasAura(SPELL_PERMANENT_FEIGN_DEATH)) + if (Creature* target = GetHitCreature()) { - target->RemoveAurasDueToSpell(SPELL_PERMANENT_FEIGN_DEATH); - target->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); - target->SetUInt32Value(UNIT_FIELD_FLAGS_2, 0); - target->SetHealth(target->GetMaxHealth() / 2); - target->SetPower(POWER_MANA, uint32(target->GetMaxPower(POWER_MANA) * 0.75f)); + if (target->HasAura(SPELL_PERMANENT_FEIGN_DEATH)) + { + target->RemoveAurasDueToSpell(SPELL_PERMANENT_FEIGN_DEATH); + target->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); + target->SetUInt32Value(UNIT_FIELD_FLAGS_2, 0); + target->SetHealth(target->GetMaxHealth() / 2); + target->SetPower(POWER_MANA, uint32(target->GetMaxPower(POWER_MANA) * 0.75f)); + } } } - } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_symbol_of_life_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_symbol_of_life_dummy_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_symbol_of_life_dummy_SpellScript(); - }; + SpellScript* GetSpellScript() const + { + return new spell_symbol_of_life_dummy_SpellScript(); + }; }; // http://www.wowhead.com/quest=12659 Scalps! // 52090 Ahunae's Knife -enum eQuest12659Data +enum Quest12659Data { NPC_SCALPS_KC_BUNNY = 28622, }; class spell_q12659_ahunaes_knife : public SpellScriptLoader { -public: - spell_q12659_ahunaes_knife() : SpellScriptLoader("spell_q12659_ahunaes_knife") { } - - class spell_q12659_ahunaes_knife_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q12659_ahunaes_knife_SpellScript); + public: + spell_q12659_ahunaes_knife() : SpellScriptLoader("spell_q12659_ahunaes_knife") { } - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_q12659_ahunaes_knife_SpellScript : public SpellScript { - Player* caster = GetCaster()->ToPlayer(); - if (!caster) - return; + PrepareSpellScript(spell_q12659_ahunaes_knife_SpellScript); - if (Creature* target = GetTargetUnit()->ToCreature()) + bool Load() { - target->ForcedDespawn(); - caster->KilledMonsterCredit(NPC_SCALPS_KC_BUNNY, 0); + return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - } - void Register() - { - OnEffectHitTarget += SpellEffectFn(spell_q12659_ahunaes_knife_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - } - }; + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + if (Creature* target = GetHitCreature()) + { + target->ForcedDespawn(); + caster->KilledMonsterCredit(NPC_SCALPS_KC_BUNNY, 0); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q12659_ahunaes_knife_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; - SpellScript* GetSpellScript() const - { - return new spell_q12659_ahunaes_knife_SpellScript(); - }; + SpellScript* GetSpellScript() const + { + return new spell_q12659_ahunaes_knife_SpellScript(); + }; }; enum StoppingTheSpread @@ -875,16 +864,21 @@ class spell_q9874_liquid_fire : public SpellScriptLoader { PrepareSpellScript(spell_q9874_liquid_fire_SpellScript); + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + void HandleDummy(SpellEffIndex /*effIndex*/) { Player* caster = GetCaster()->ToPlayer(); - Creature* target = GetHitUnit()->ToCreature(); - if (!caster || !target || (target && target->HasAura(SPELL_FLAMES))) - return; - - caster->KilledMonsterCredit(NPC_VILLAGER_KILL_CREDIT, 0); - target->CastSpell(target, SPELL_FLAMES, true); - target->DespawnOrUnsummon(60000); + if (Creature* target = GetHitCreature()) + if (target && target->HasAura(SPELL_FLAMES)) + { + caster->KilledMonsterCredit(NPC_VILLAGER_KILL_CREDIT, 0); + target->CastSpell(target, SPELL_FLAMES, true); + target->DespawnOrUnsummon(60000); + } } void Register() @@ -915,16 +909,20 @@ class spell_q12805_lifeblood_dummy : public SpellScriptLoader { PrepareSpellScript(spell_q12805_lifeblood_dummy_SpellScript); + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + void HandleScript(SpellEffIndex /*effIndex*/) { Player* caster = GetCaster()->ToPlayer(); - Creature* target = GetHitUnit()->ToCreature(); - if (!caster || !target) - return; - - caster->KilledMonsterCredit(NPC_SHARD_KILL_CREDIT, 0); - target->CastSpell(target, uint32(GetEffectValue()), true); - target->DespawnOrUnsummon(2000); + if (Creature* target = GetHitCreature()) + { + caster->KilledMonsterCredit(NPC_SHARD_KILL_CREDIT, 0); + target->CastSpell(target, uint32(GetEffectValue()), true); + target->DespawnOrUnsummon(2000); + } } void Register() @@ -945,37 +943,38 @@ class spell_q12805_lifeblood_dummy : public SpellScriptLoader 59643 Plant Horde Battle Standard 4338 Plant Alliance Battle Standard */ -enum eBattleStandard +enum BattleStandard { NPC_KING_OF_THE_MOUNTAINT_KC = 31766, }; class spell_q13280_13283_plant_battle_standard: public SpellScriptLoader { -public: - spell_q13280_13283_plant_battle_standard() : SpellScriptLoader("spell_q13280_13283_plant_battle_standard") { } + public: + spell_q13280_13283_plant_battle_standard() : SpellScriptLoader("spell_q13280_13283_plant_battle_standard") { } - class spell_q13280_13283_plant_battle_standard_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q13280_13283_plant_battle_standard_SpellScript) - void HandleDummy(SpellEffIndex /*effIndex*/) + class spell_q13280_13283_plant_battle_standard_SpellScript : public SpellScript { - Unit* caster = GetCaster(); - if (caster->IsVehicle()) - if (Unit* player = caster->GetVehicleKit()->GetPassenger(0)) - player->ToPlayer()->KilledMonsterCredit(NPC_KING_OF_THE_MOUNTAINT_KC, 0); - } + PrepareSpellScript(spell_q13280_13283_plant_battle_standard_SpellScript); - void Register() + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (caster->IsVehicle()) + if (Unit* player = caster->GetVehicleKit()->GetPassenger(0)) + player->ToPlayer()->KilledMonsterCredit(NPC_KING_OF_THE_MOUNTAINT_KC, 0); + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_q13280_13283_plant_battle_standard_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHit += SpellEffectFn(spell_q13280_13283_plant_battle_standard_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + return new spell_q13280_13283_plant_battle_standard_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_q13280_13283_plant_battle_standard_SpellScript(); - } }; enum ChumTheWaterSummons @@ -988,42 +987,36 @@ enum ChumTheWaterSummons class spell_q14112_14145_chum_the_water: public SpellScriptLoader { -public: - spell_q14112_14145_chum_the_water() : SpellScriptLoader("spell_q14112_14145_chum_the_water") { } - - class spell_q14112_14145_chum_the_water_SpellScript : public SpellScript - { - PrepareSpellScript(spell_q14112_14145_chum_the_water_SpellScript); - - bool Validate(SpellInfo const* /*spellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(SUMMON_ANGRY_KVALDIR)) - return false; - if (!sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_MAKO)) - return false; - if (!sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_THRESHER)) - return false; - if (!sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_BLUE_SHARK)) - return false; - return true; - } + public: + spell_q14112_14145_chum_the_water() : SpellScriptLoader("spell_q14112_14145_chum_the_water") { } - void HandleScriptEffect(SpellEffIndex /*effIndex*/) + class spell_q14112_14145_chum_the_water_SpellScript : public SpellScript { - Unit* caster = GetCaster(); - caster->CastSpell(caster, RAND(SUMMON_ANGRY_KVALDIR, SUMMON_NORTH_SEA_MAKO, SUMMON_NORTH_SEA_THRESHER, SUMMON_NORTH_SEA_BLUE_SHARK)); - } + PrepareSpellScript(spell_q14112_14145_chum_the_water_SpellScript); + + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SUMMON_ANGRY_KVALDIR) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_MAKO) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_THRESHER) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_BLUE_SHARK)) + return false; + return true; + } - void Register() + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + caster->CastSpell(caster, RAND(SUMMON_ANGRY_KVALDIR, SUMMON_NORTH_SEA_MAKO, SUMMON_NORTH_SEA_THRESHER, SUMMON_NORTH_SEA_BLUE_SHARK)); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_q14112_14145_chum_the_water_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_q14112_14145_chum_the_water_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + return new spell_q14112_14145_chum_the_water_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_q14112_14145_chum_the_water_SpellScript(); - } }; // http://old01.wowhead.com/quest=9452 - Red Snapper - Very Tasty! @@ -1041,15 +1034,16 @@ class spell_q9452_cast_net: public SpellScriptLoader class spell_q9452_cast_net_SpellScript : public SpellScript { - PrepareSpellScript(spell_q9452_cast_net_SpellScript) + PrepareSpellScript(spell_q9452_cast_net_SpellScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } void HandleDummy(SpellEffIndex /*effIndex*/) { Player* caster = GetCaster()->ToPlayer(); - - if (!caster) - return; - switch (urand(0, 2)) { case 0: case 1: diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index c88d7b891d6..0be2bf6b40c 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -21,7 +21,6 @@ * Scriptnames of files in this file should be prefixed with "spell_rog_". */ -#include "ScriptPCH.h" #include "SpellAuraEffects.h" enum RogueSpells @@ -29,120 +28,114 @@ enum RogueSpells ROGUE_SPELL_SHIV_TRIGGERED = 5940, ROGUE_SPELL_GLYPH_OF_PREPARATION = 56819, ROGUE_SPELL_PREY_ON_THE_WEAK = 58670, + ROGUE_SPELL_CHEAT_DEATH_COOLDOWN = 31231, }; // Cheat Death class spell_rog_cheat_death : public SpellScriptLoader { -public: - spell_rog_cheat_death() : SpellScriptLoader("spell_rog_cheat_death") { } + public: + spell_rog_cheat_death() : SpellScriptLoader("spell_rog_cheat_death") { } - class spell_rog_cheat_death_AuraScript : public AuraScript - { - PrepareAuraScript(spell_rog_cheat_death_AuraScript); + class spell_rog_cheat_death_AuraScript : public AuraScript + { + PrepareAuraScript(spell_rog_cheat_death_AuraScript); - uint32 absorbChance; + uint32 absorbChance; - enum Spell - { - ROG_SPELL_CHEAT_DEATH_COOLDOWN = 31231, - }; + bool Validate(SpellInfo const* /*spellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN)) + return false; + return true; + } - bool Validate(SpellInfo const* /*spellEntry*/) - { - return sSpellMgr->GetSpellInfo(ROG_SPELL_CHEAT_DEATH_COOLDOWN); - } + bool Load() + { + absorbChance = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); + return GetUnitOwner()->ToPlayer(); + } - bool Load() - { - absorbChance = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); - return GetUnitOwner()->ToPlayer(); - } + void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) + { + // Set absorbtion amount to unlimited + amount = -1; + } - void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) - { - // Set absorbtion amount to unlimited - amount = -1; - } + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + { + Player* target = GetTarget()->ToPlayer(); + if (dmgInfo.GetDamage() < target->GetHealth() || target->HasSpellCooldown(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN) || !roll_chance_i(absorbChance)) + return; - void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) - { - Unit* target = GetTarget(); - if (dmgInfo.GetDamage() < target->GetHealth()) - return; - if (target->ToPlayer()->HasSpellCooldown(ROG_SPELL_CHEAT_DEATH_COOLDOWN)) - return; - if (!roll_chance_i(absorbChance)) - return; - - target->CastSpell(target, ROG_SPELL_CHEAT_DEATH_COOLDOWN, true); - target->ToPlayer()->AddSpellCooldown(ROG_SPELL_CHEAT_DEATH_COOLDOWN, 0, time(NULL) + 60); - - uint32 health10 = target->CountPctFromMaxHealth(10); - - // hp > 10% - absorb hp till 10% - if (target->GetHealth() > health10) - absorbAmount = dmgInfo.GetDamage() - target->GetHealth() + health10; - // hp lower than 10% - absorb everything - else - absorbAmount = dmgInfo.GetDamage(); - } + target->CastSpell(target, ROGUE_SPELL_CHEAT_DEATH_COOLDOWN, true); + target->AddSpellCooldown(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN, 0, time(NULL) + 60); - void Register() + uint32 health10 = target->CountPctFromMaxHealth(10); + + // hp > 10% - absorb hp till 10% + if (target->GetHealth() > health10) + absorbAmount = dmgInfo.GetDamage() - target->GetHealth() + health10; + // hp lower than 10% - absorb everything + else + absorbAmount = dmgInfo.GetDamage(); + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_cheat_death_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_cheat_death_AuraScript::Absorb, EFFECT_0); + } + }; + + AuraScript* GetAuraScript() const { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_cheat_death_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); - OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_cheat_death_AuraScript::Absorb, EFFECT_0); + return new spell_rog_cheat_death_AuraScript(); } - }; - - AuraScript* GetAuraScript() const - { - return new spell_rog_cheat_death_AuraScript(); - } }; // 31130 - Nerves of Steel class spell_rog_nerves_of_steel : public SpellScriptLoader { -public: - spell_rog_nerves_of_steel() : SpellScriptLoader("spell_rog_nerves_of_steel") { } + public: + spell_rog_nerves_of_steel() : SpellScriptLoader("spell_rog_nerves_of_steel") { } - class spell_rog_nerves_of_steel_AuraScript : public AuraScript - { - PrepareAuraScript(spell_rog_nerves_of_steel_AuraScript); + class spell_rog_nerves_of_steel_AuraScript : public AuraScript + { + PrepareAuraScript(spell_rog_nerves_of_steel_AuraScript); - uint32 absorbPct; + uint32 absorbPct; - bool Load() - { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); - return true; - } + bool Load() + { + absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); + return true; + } - void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) - { - // Set absorbtion amount to unlimited - amount = -1; - } + void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) + { + // Set absorbtion amount to unlimited + amount = -1; + } - void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) - { - // reduces all damage taken while stun or fear - if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<GetTypeId() == TYPEID_PLAYER; + } + bool Validate(SpellInfo const* /*spellEntry*/) { if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_GLYPH_OF_PREPARATION)) @@ -162,12 +161,10 @@ class spell_rog_preparation : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - Unit* caster = GetCaster(); - if (caster->GetTypeId() != TYPEID_PLAYER) - return; + Player* caster = GetCaster()->ToPlayer(); //immediately finishes the cooldown on certain Rogue abilities - const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap(); + const SpellCooldowns& cm = caster->GetSpellCooldownMap(); for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); @@ -176,14 +173,14 @@ class spell_rog_preparation : public SpellScriptLoader { if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) // Vanish, Evasion, Sprint - caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true); + caster->RemoveSpellCooldown((itr++)->first, true); else if (caster->HasAura(ROGUE_SPELL_GLYPH_OF_PREPARATION)) { if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick (spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY && // Blade Flurry spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY)) - caster->ToPlayer()->RemoveSpellCooldown((itr++)->first, true); + caster->RemoveSpellCooldown((itr++)->first, true); else ++itr; } @@ -216,7 +213,8 @@ public: class spell_rog_prey_on_the_weak_AuraScript : public AuraScript { - PrepareAuraScript(spell_rog_prey_on_the_weak_AuraScript) + PrepareAuraScript(spell_rog_prey_on_the_weak_AuraScript); + bool Validate(SpellInfo const* /*spellEntry*/) { if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_PREY_ON_THE_WEAK)) @@ -259,7 +257,13 @@ class spell_rog_shiv : public SpellScriptLoader class spell_rog_shiv_SpellScript : public SpellScript { - PrepareSpellScript(spell_rog_shiv_SpellScript) + PrepareSpellScript(spell_rog_shiv_SpellScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + bool Validate(SpellInfo const* /*spellEntry*/) { if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_SHIV_TRIGGERED)) @@ -270,9 +274,6 @@ class spell_rog_shiv : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); - if (caster->GetTypeId() != TYPEID_PLAYER) - return; - if (Unit* unitTarget = GetHitUnit()) caster->CastSpell(unitTarget, ROGUE_SPELL_SHIV_TRIGGERED, true); } @@ -297,8 +298,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader class spell_rog_deadly_poison_SpellScript : public SpellScript { - PrepareSpellScript(spell_rog_deadly_poison_SpellScript) - + PrepareSpellScript(spell_rog_deadly_poison_SpellScript); bool Load() { @@ -309,13 +309,10 @@ class spell_rog_deadly_poison : public SpellScriptLoader void HandleBeforeHit() { - Unit* target = GetHitUnit(); - if (!target) - return; - - // Deadly Poison - if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0x80000, 0, GetCaster()->GetGUID())) - _stackAmount = aurEff->GetBase()->GetStackAmount(); + if (Unit* target = GetHitUnit()) + // Deadly Poison + if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0x80000, 0, GetCaster()->GetGUID())) + _stackAmount = aurEff->GetBase()->GetStackAmount(); } void HandleAfterHit() @@ -324,49 +321,50 @@ class spell_rog_deadly_poison : public SpellScriptLoader return; Player* player = GetCaster()->ToPlayer(); - Unit* target = GetHitUnit(); - if (!target) - return; - - Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); + + if (Unit* target = GetHitUnit()) + { - if (item == GetCastItem()) - item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); + Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); - if (!item) - return; + if (item == GetCastItem()) + item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); - // item combat enchantments - for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot) - { - SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(EnchantmentSlot(slot))); - if (!enchant) - continue; + if (!item) + return; - for (uint8 s = 0; s < 3; ++s) + // item combat enchantments + for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot) { - if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) + SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(EnchantmentSlot(slot))); + if (!enchant) continue; - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]); - if (!spellInfo) + for (uint8 s = 0; s < 3; ++s) { - sLog->outError("Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName(), player->GetGUIDLow(), enchant->spellid[s]); - continue; + if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) + continue; + + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]); + if (!spellInfo) + { + sLog->outError("Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName(), player->GetGUIDLow(), enchant->spellid[s]); + continue; + } + + // Proc only rogue poisons + if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON) + continue; + + // Do not reproc deadly + if (spellInfo->SpellFamilyFlags.IsEqual(0x10000, 0x80000, 0)) + continue; + + if (spellInfo->IsPositive()) + player->CastSpell(player, enchant->spellid[s], true, item); + else + player->CastSpell(target, enchant->spellid[s], true, item); } - - // Proc only rogue poisons - if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON) - continue; - - // Do not reproc deadly - if (spellInfo->SpellFamilyFlags.IsEqual(0x10000, 0x80000, 0)) - continue; - - if (spellInfo->IsPositive()) - player->CastSpell(player, enchant->spellid[s], true, item); - else - player->CastSpell(target, enchant->spellid[s], true, item); } } } diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index b0116d6d33d..be5d04c1597 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -21,7 +21,6 @@ * Scriptnames of files in this file should be prefixed with "spell_sha_". */ -#include "ScriptPCH.h" #include "SpellAuraEffects.h" enum ShamanSpells @@ -94,9 +93,7 @@ class spell_sha_fire_nova : public SpellScriptLoader bool Validate(SpellInfo const* spellEntry) { - if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_FIRE_NOVA_R1)) - return false; - if (sSpellMgr->GetFirstSpellInChain(SHAMAN_SPELL_FIRE_NOVA_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id)) + if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_FIRE_NOVA_R1) || sSpellMgr->GetFirstSpellInChain(SHAMAN_SPELL_FIRE_NOVA_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id)) return false; uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id); @@ -119,13 +116,15 @@ class spell_sha_fire_nova : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - Unit* caster = GetCaster(); - uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); - if (uint32 spellId = sSpellMgr->GetSpellWithRank(SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1, rank)) + if (Unit* caster = GetCaster()) { - Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[1]); - if (totem && totem->isTotem()) - caster->CastSpell(totem, spellId, true); + uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); + if (uint32 spellId = sSpellMgr->GetSpellWithRank(SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1, rank)) + { + Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[1]); + if (totem && totem->isTotem()) + caster->CastSpell(totem, spellId, true); + } } } @@ -154,30 +153,28 @@ class spell_sha_mana_tide_totem : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE)) - return false; - if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_MANA_TIDE_TOTEM)) + if (!sSpellMgr->GetSpellInfo(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE) || !sSpellMgr->GetSpellInfo(SHAMAN_SPELL_MANA_TIDE_TOTEM)) return false; return true; } void HandleDummy(SpellEffIndex /*effIndex*/) { - Unit* caster = GetCaster(); - if (Unit* unitTarget = GetHitUnit()) - { - if (unitTarget->getPowerType() == POWER_MANA) + if (Unit* caster = GetCaster()) + if (Unit* unitTarget = GetHitUnit()) { - int32 effValue = GetEffectValue(); - // Glyph of Mana Tide - if (Unit* owner = caster->GetOwner()) - if (AuraEffect* dummy = owner->GetAuraEffect(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE, 0)) - effValue += dummy->GetAmount(); - // Regenerate 6% of Total Mana Every 3 secs - int32 effBasePoints0 = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), effValue)); - caster->CastCustomSpell(unitTarget, SHAMAN_SPELL_MANA_TIDE_TOTEM, &effBasePoints0, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID()); + if (unitTarget->getPowerType() == POWER_MANA) + { + int32 effValue = GetEffectValue(); + // Glyph of Mana Tide + if (Unit* owner = caster->GetOwner()) + if (AuraEffect* dummy = owner->GetAuraEffect(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE, 0)) + effValue += dummy->GetAmount(); + // Regenerate 6% of Total Mana Every 3 secs + int32 effBasePoints0 = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), effValue)); + caster->CastCustomSpell(unitTarget, SHAMAN_SPELL_MANA_TIDE_TOTEM, &effBasePoints0, NULL, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID()); + } } - } } void Register() @@ -204,22 +201,20 @@ class spell_sha_earthbind_totem : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM)) - return false; - if (!sSpellMgr->GetSpellInfo(SHAMAN_TOTEM_SPELL_EARTHEN_POWER)) + if (!sSpellMgr->GetSpellInfo(SHAMAN_TOTEM_SPELL_EARTHBIND_TOTEM) || !sSpellMgr->GetSpellInfo(SHAMAN_TOTEM_SPELL_EARTHEN_POWER)) return false; return true; } void HandleEffectPeriodic(AuraEffect const* aurEff) { - Unit* target = GetTarget(); - if (Unit* caster = aurEff->GetBase()->GetCaster()) - if (TempSummon* summon = caster->ToTempSummon()) - if (Unit* owner = summon->GetOwner()) - if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0)) - if (roll_chance_i(aur->GetBaseAmount()) && target->HasAuraWithMechanic(1 << MECHANIC_SNARE)) - caster->CastSpell(caster, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true, NULL, aurEff); + if (Unit* target = GetTarget()) + if (Unit* caster = aurEff->GetBase()->GetCaster()) + if (TempSummon* summon = caster->ToTempSummon()) + if (Unit* owner = summon->GetOwner()) + if (AuraEffect* aur = owner->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0)) + if (roll_chance_i(aur->GetBaseAmount()) && target->HasAuraWithMechanic(1 << MECHANIC_SNARE)) + caster->CastSpell(caster, SHAMAN_TOTEM_SPELL_EARTHEN_POWER, true, NULL, aurEff); } void Register() @@ -257,7 +252,8 @@ class spell_sha_bloodlust : public SpellScriptLoader void ApplyDebuff() { - GetHitUnit()->CastSpell(GetHitUnit(), SHAMAN_SPELL_SATED, true); + if (Unit* target = GetHitUnit()) + target->CastSpell(target, SHAMAN_SPELL_SATED, true); } void Register() @@ -298,7 +294,8 @@ class spell_sha_heroism : public SpellScriptLoader void ApplyDebuff() { - GetHitUnit()->CastSpell(GetHitUnit(), SHAMAN_SPELL_EXHAUSTION, true); + if (Unit* target = GetHitUnit()) + target->CastSpell(target, SHAMAN_SPELL_EXHAUSTION, true); } void Register() @@ -316,6 +313,232 @@ class spell_sha_heroism : public SpellScriptLoader } }; +enum AncestralAwakeningProc +{ + SPELL_ANCESTRAL_AWAKENING_PROC = 52752, +}; + +class spell_sha_ancestral_awakening_proc : public SpellScriptLoader +{ + public: + spell_sha_ancestral_awakening_proc() : SpellScriptLoader("spell_sha_ancestral_awakening_proc") { } + + class spell_sha_ancestral_awakening_proc_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sha_ancestral_awakening_proc_SpellScript); + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_ANCESTRAL_AWAKENING_PROC)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + int32 damage = GetEffectValue(); + if (GetCaster() && GetHitUnit()) + GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_ANCESTRAL_AWAKENING_PROC, &damage, NULL, NULL, true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_sha_ancestral_awakening_proc_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_sha_ancestral_awakening_proc_SpellScript(); + } +}; + +enum CleansingTotemPulse +{ + SPELL_CLEANSING_TOTEM_EFFECT = 52025, +}; + +class spell_sha_cleansing_totem_pulse : public SpellScriptLoader +{ + public: + spell_sha_cleansing_totem_pulse() : SpellScriptLoader("spell_sha_cleansing_totem_pulse") { } + + class spell_sha_cleansing_totem_pulse_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sha_cleansing_totem_pulse_SpellScript); + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_CLEANSING_TOTEM_EFFECT)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + int32 bp = 1; + if (GetCaster() && GetHitUnit() && GetOriginalCaster()) + GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_CLEANSING_TOTEM_EFFECT, NULL, &bp, NULL, true, NULL, NULL, GetOriginalCaster()->GetGUID()); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_sha_cleansing_totem_pulse_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_sha_cleansing_totem_pulse_SpellScript(); + } +}; + +enum HealingStreamTotem +{ + SPELL_GLYPH_OF_HEALING_STREAM_TOTEM = 55456, + ICON_ID_RESTORATIVE_TOTEMS = 338, + SPELL_HEALING_STREAM_TOTEM_HEAL = 52042, +}; + +class spell_sha_healing_stream_totem : public SpellScriptLoader +{ + public: + spell_sha_healing_stream_totem() : SpellScriptLoader("spell_sha_healing_stream_totem") { } + + class spell_sha_healing_stream_totem_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sha_healing_stream_totem_SpellScript); + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM) || !sSpellMgr->GetSpellInfo(SPELL_HEALING_STREAM_TOTEM_HEAL)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + int32 damage = GetEffectValue(); + SpellInfo const* triggeringSpell = GetTriggeringSpell(); + if (Unit* target = GetHitUnit()) + if (Unit* caster = GetCaster()) + { + if (Unit* owner = caster->GetOwner()) + { + if (triggeringSpell) + damage = int32(owner->SpellHealingBonus(target, triggeringSpell, damage, HEAL)); + + // Restorative Totems + if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, ICON_ID_RESTORATIVE_TOTEMS, 1)) + AddPctN(damage, dummy->GetAmount()); + + // Glyph of Healing Stream Totem + if (AuraEffect const* aurEff = owner->GetAuraEffect(SPELL_GLYPH_OF_HEALING_STREAM_TOTEM, EFFECT_0)) + AddPctN(damage, aurEff->GetAmount()); + } + caster->CastCustomSpell(target, SPELL_HEALING_STREAM_TOTEM_HEAL, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID()); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_sha_healing_stream_totem_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_sha_healing_stream_totem_SpellScript(); + } +}; + +enum ManaSpringTotem +{ + SPELL_MANA_SPRING_TOTEM_ENERGIZE = 52032, +}; + +class spell_sha_mana_spring_totem : public SpellScriptLoader +{ + public: + spell_sha_mana_spring_totem() : SpellScriptLoader("spell_sha_mana_spring_totem") { } + + class spell_sha_mana_spring_totem_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sha_mana_spring_totem_SpellScript); + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_MANA_SPRING_TOTEM_ENERGIZE)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + int32 damage = GetEffectValue(); + if (Unit* target = GetHitUnit()) + if (Unit* caster = GetCaster()) + if (target->getPowerType() == POWER_MANA) + caster->CastCustomSpell(target, SPELL_MANA_SPRING_TOTEM_ENERGIZE, &damage, 0, 0, true, 0, 0, GetOriginalCaster()->GetGUID()); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_sha_mana_spring_totem_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + + }; + + SpellScript* GetSpellScript() const + { + return new spell_sha_mana_spring_totem_SpellScript(); + } +}; + +class spell_sha_lava_lash : public SpellScriptLoader +{ + public: + spell_sha_lava_lash() : SpellScriptLoader("spell_sha_lava_lash") { } + + class spell_sha_lava_lash_SpellScript : public SpellScript + { + PrepareSpellScript(spell_sha_lava_lash_SpellScript) + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + if (Player* caster = GetCaster()->ToPlayer()) + { + int32 damage = GetEffectValue(); + int32 hitDamage = GetHitDamage(); + if (caster->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND)) + { + // Damage is increased by 25% if your off-hand weapon is enchanted with Flametongue. + if (caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000, 0, 0)) + AddPctN(hitDamage, damage); + SetHitDamage(hitDamage); + } + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_sha_lava_lash_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); + } + + }; + + SpellScript* GetSpellScript() const + { + return new spell_sha_lava_lash_SpellScript(); + } +}; + + void AddSC_shaman_spell_scripts() { new spell_sha_astral_shift(); @@ -324,4 +547,9 @@ void AddSC_shaman_spell_scripts() new spell_sha_earthbind_totem(); new spell_sha_bloodlust(); new spell_sha_heroism(); + new spell_sha_ancestral_awakening_proc(); + new spell_sha_cleansing_totem_pulse(); + new spell_sha_healing_stream_totem(); + new spell_sha_mana_spring_totem(); + new spell_sha_lava_lash(); } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 51b2de5d0f3..bf1c205f1af 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -21,7 +21,6 @@ * Scriptnames of files in this file should be prefixed with "spell_warl_". */ -#include "ScriptPCH.h" #include "Spell.h" #include "SpellAuraEffects.h" @@ -99,15 +98,7 @@ class spell_warl_demonic_empowerment : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS)) - return false; - if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER)) - return false; - if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD)) - return false; - if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER)) - return false; - if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_IMP)) + if (!sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_SUCCUBUS) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_VOIDWALKER) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELGUARD) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_FELHUNTER) || !sSpellMgr->GetSpellInfo(WARLOCK_DEMONIC_EMPOWERMENT_IMP)) return false; return true; } @@ -172,9 +163,7 @@ class spell_warl_create_healthstone : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R1)) - return false; - if (!sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R2)) + if (!sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R1) || !sSpellMgr->GetSpellInfo(WARLOCK_IMPROVED_HEALTHSTONE_R2)) return false; return true; } @@ -267,7 +256,8 @@ public: void HandleDummy(SpellEffIndex /*effIndex*/) { - GetCaster()->CastSpell(GetCaster(), GetEffectValue(), true); + Unit* caster = GetCaster(); + caster->CastSpell(caster, GetEffectValue(), true); } void Register() @@ -293,7 +283,8 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader void FilterTargets(std::list& unitList) { - unitList.remove(GetTargetUnit()); + if (GetTargetUnit()) + unitList.remove(GetTargetUnit()); } void Register() @@ -308,6 +299,147 @@ class spell_warl_seed_of_corruption : public SpellScriptLoader } }; +enum Soulshatter +{ + SPELL_SOULSHATTER = 32835, +}; + +class spell_warl_soulshatter : public SpellScriptLoader +{ + public: + spell_warl_soulshatter() : SpellScriptLoader("spell_warl_soulshatter") { } + + class spell_warl_soulshatter_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warl_soulshatter_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_SOULSHATTER)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) + if (target->CanHaveThreatList() && target->getThreatManager().getThreat(caster) > 0.0f) + { + sLog->outString("THREATREDUCTION"); + caster->CastSpell(target, SPELL_SOULSHATTER, true); + } else + sLog->outString("can have threat? %b . threat number? %f ",target->CanHaveThreatList(),target->getThreatManager().getThreat(caster)); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_warl_soulshatter_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warl_soulshatter_SpellScript(); + } +}; + +enum LifeTap +{ + SPELL_LIFE_TAP_RANK_6 = 11689, + SPELL_LIFE_TAP_RANK_7 = 27222, + SPELL_LIFE_TAP_RANK_8 = 57946, + SPELL_LIFE_TAP_ENERGIZE = 31818, + SPELL_LIFE_TAP_ENERGIZE_2 = 32553, + ICON_ID_IMPROVED_LIFE_TAP = 208, + ICON_ID_MANA_FEED = 1982, +}; + +class spell_warl_life_tap : public SpellScriptLoader +{ + public: + spell_warl_life_tap() : SpellScriptLoader("spell_warl_life_tap") { } + + class spell_warl_life_tap_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warl_life_tap_SpellScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_RANK_6) || !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_RANK_7) + || !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_RANK_8) || !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_ENERGIZE) + || !sSpellMgr->GetSpellInfo(SPELL_LIFE_TAP_ENERGIZE_2)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + if (Unit* target = GetHitUnit()) + { + SpellInfo const* spellInfo = GetSpellInfo(); + float spFactor = 0.0f; + int32 damage = int32(GetEffectValue() + (6.3875 * spellInfo->BaseLevel)); + switch (spellInfo->Id) + { + case SPELL_LIFE_TAP_RANK_6: spFactor = 0.2f; break; + case SPELL_LIFE_TAP_RANK_7: + case SPELL_LIFE_TAP_RANK_8: spFactor = 0.5f; break; + default: break; + } + + int32 mana = int32(damage + (caster->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+SPELL_SCHOOL_SHADOW) * spFactor)); + + // Shouldn't Appear in Combat Log + target->ModifyHealth(-damage); + + // Improved Life Tap mod + if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, ICON_ID_IMPROVED_LIFE_TAP, 0)) + AddPctN(mana, aurEff->GetAmount()); + + caster->CastCustomSpell(target, SPELL_LIFE_TAP_ENERGIZE, &mana, NULL, NULL, false); + + // Mana Feed + int32 manaFeedVal = 0; + if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARLOCK, ICON_ID_MANA_FEED, 0)) + manaFeedVal = aurEff->GetAmount(); + + if (manaFeedVal > 0) + { + ApplyPctN(manaFeedVal, mana); + caster->CastCustomSpell(caster, SPELL_LIFE_TAP_ENERGIZE_2, &manaFeedVal, NULL, NULL, true, NULL); + } + } + } + + SpellCastResult CheckCast() + { + if ((int32(GetCaster()->GetHealth()) > int32(GetSpellInfo()->Effects[EFFECT_0].CalcValue() + (6.3875 * GetSpellInfo()->BaseLevel)))) + { + return SPELL_CAST_OK; + } + return SPELL_FAILED_FIZZLE; + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_warl_life_tap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnCheckCast += SpellCheckCastFn(spell_warl_life_tap_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warl_life_tap_SpellScript(); + } +}; + void AddSC_warlock_spell_scripts() { new spell_warl_banish(); @@ -316,4 +448,6 @@ void AddSC_warlock_spell_scripts() new spell_warl_everlasting_affliction(); new spell_warl_ritual_of_doom_effect(); new spell_warl_seed_of_corruption(); + new spell_warl_soulshatter(); + new spell_warl_life_tap(); } diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index f39ad3d1426..cf4c7bfdec8 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -21,7 +21,6 @@ * Scriptnames of files in this file should be prefixed with "spell_warr_". */ -#include "ScriptPCH.h" enum WarriorSpells { @@ -46,8 +45,11 @@ class spell_warr_last_stand : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - int32 healthModSpellBasePoints0 = int32(GetCaster()->CountPctFromMaxHealth(30)); - GetCaster()->CastCustomSpell(GetCaster(), WARRIOR_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); + if (Unit* caster = GetCaster()) + { + int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(30)); + caster->CastCustomSpell(caster, WARRIOR_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); + } } void Register() @@ -74,7 +76,8 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader void FilterTargets(std::list& unitList) { - unitList.remove(GetCaster()); + if (GetCaster()) + unitList.remove(GetCaster()); } void Register() @@ -115,23 +118,19 @@ public: void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* target = GetTarget(); - target->CastSpell(target, SPELL_DAMAGE_REDUCTION_AURA, true); + if (Unit* target = GetTarget()) + target->CastSpell(target, SPELL_DAMAGE_REDUCTION_AURA, true); } void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* target = GetTarget(); - - if (!target->HasAura(SPELL_DAMAGE_REDUCTION_AURA)) - return; - - if (target->HasAura(SPELL_BLESSING_OF_SANCTUARY) || - target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) || - target->HasAura(SPELL_RENEWED_HOPE)) - return; - - target->RemoveAurasDueToSpell(SPELL_DAMAGE_REDUCTION_AURA); + if (Unit* target = GetTarget()) + { + if (target->HasAura(SPELL_DAMAGE_REDUCTION_AURA) && !(target->HasAura(SPELL_BLESSING_OF_SANCTUARY) || + target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) || + target->HasAura(SPELL_RENEWED_HOPE))) + target->RemoveAurasDueToSpell(SPELL_DAMAGE_REDUCTION_AURA); + } } void Register() @@ -148,9 +147,278 @@ public: } }; +enum DeepWounds +{ + SPELL_DEEP_WOUNDS_RANK_1 = 12162, + SPELL_DEEP_WOUNDS_RANK_2 = 12850, + SPELL_DEEP_WOUNDS_RANK_3 = 12868, + SPELL_DEEP_WOUNDS_RANK_PERIODIC = 12721, +}; + +class spell_warr_deep_wounds : public SpellScriptLoader +{ + public: + spell_warr_deep_wounds() : SpellScriptLoader("spell_warr_deep_wounds") { } + + class spell_warr_deep_wounds_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warr_deep_wounds_SpellScript); + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_1) || !sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_2) || !sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_3)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /* effIndex */) + { + int32 damage = GetEffectValue(); + if (Unit* target = GetHitUnit()) + if (Unit* caster = GetCaster()) + { + // apply percent damage mods + damage = caster->SpellDamageBonus(target, GetSpellInfo(), damage, SPELL_DIRECT_DAMAGE); + + ApplyPctN(damage, 16 * sSpellMgr->GetSpellRank(GetSpellInfo()->Id)); + + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_DEEP_WOUNDS_RANK_PERIODIC); + uint32 ticks = spellInfo->GetDuration() / spellInfo->Effects[EFFECT_0].Amplitude; + + // Add remaining ticks to damage done + if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_DEEP_WOUNDS_RANK_PERIODIC, EFFECT_0, caster->GetGUID())) + damage += aurEff->GetAmount() * (ticks - aurEff->GetTickNumber()); + + damage = damage / ticks; + caster->CastCustomSpell(target, SPELL_DEEP_WOUNDS_RANK_PERIODIC, &damage, NULL, NULL, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_warr_deep_wounds_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warr_deep_wounds_SpellScript(); + } +}; + +enum Charge +{ + SPELL_JUGGERNAUT_CRIT_BONUS_TALENT = 64976, + SPELL_JUGGERNAUT_CRIT_BONUS_BUFF = 65156, + SPELL_CHARGE = 34846, +}; + +class spell_warr_charge : public SpellScriptLoader +{ + public: + spell_warr_charge() : SpellScriptLoader("spell_warr_charge") { } + + class spell_warr_charge_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warr_charge_SpellScript); + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_JUGGERNAUT_CRIT_BONUS_TALENT) || !sSpellMgr->GetSpellInfo(SPELL_JUGGERNAUT_CRIT_BONUS_BUFF) || !sSpellMgr->GetSpellInfo(SPELL_CHARGE)) + return false; + return true; + } + void HandleDummy(SpellEffIndex /* effIndex */) + { + int32 chargeBasePoints0 = GetEffectValue(); + Unit* caster = GetCaster(); + caster->CastCustomSpell(caster, SPELL_CHARGE, &chargeBasePoints0, NULL, NULL, true); + + //Juggernaut crit bonus + if (caster->HasAura(SPELL_JUGGERNAUT_CRIT_BONUS_TALENT)) + caster->CastSpell(caster, SPELL_JUGGERNAUT_CRIT_BONUS_BUFF, true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_warr_charge_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warr_charge_SpellScript(); + } +}; + +enum Slam +{ + SPELL_SLAM = 50783, +}; + +class spell_warr_slam : public SpellScriptLoader +{ + public: + spell_warr_slam() : SpellScriptLoader("spell_warr_slam") { } + + class spell_warr_slam_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warr_slam_SpellScript); + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_SLAM)) + return false; + return true; + } + void HandleDummy(SpellEffIndex /* effIndex */) + { + int32 bp0 = GetEffectValue(); + if (GetHitUnit()) + GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_SLAM, &bp0, NULL, NULL, true, 0); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_warr_slam_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warr_slam_SpellScript(); + } +}; + +enum Execute +{ + SPELL_EXECUTE = 20647, + SPELL_GLYPH_OF_EXECUTION = 58367, + ICON_ID_SUDDEN_DEATH = 1989, +}; + +class spell_warr_execute : public SpellScriptLoader +{ + public: + spell_warr_execute() : SpellScriptLoader("spell_warr_execute") { } + + class spell_warr_execute_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warr_execute_SpellScript); + + bool Validate(SpellInfo const* /*SpellEntry*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_EXECUTE) || !sSpellMgr->GetSpellInfo(SPELL_GLYPH_OF_EXECUTION)) + return false; + return true; + } + void HandleDummy(SpellEffIndex effIndex) + { + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) + { + SpellInfo const* spellInfo = GetSpellInfo(); + int32 rageUsed = std::min(300 - spellInfo->CalcPowerCost(caster, SpellSchoolMask(spellInfo->SchoolMask)), caster->GetPower(POWER_RAGE)); + int32 newRage = std::max(0, caster->GetPower(POWER_RAGE) - rageUsed); + + // Sudden Death rage save + if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_GENERIC, ICON_ID_SUDDEN_DEATH, EFFECT_0)) + { + int32 ragesave = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 10; + newRage = std::max(newRage, ragesave); + } + + caster->SetPower(POWER_RAGE, uint32(newRage)); + // Glyph of Execution bonus + if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_GLYPH_OF_EXECUTION, EFFECT_0)) + rageUsed += aurEff->GetAmount() * 10; + + + int32 bp = GetEffectValue() + int32(rageUsed * spellInfo->Effects[effIndex].DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f); + caster->CastCustomSpell(target,SPELL_EXECUTE,&bp,0,0,true,0,0,GetOriginalCaster()->GetGUID()); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_warr_execute_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warr_execute_SpellScript(); + } +}; + +class spell_warr_concussion_blow : public SpellScriptLoader +{ + public: + spell_warr_concussion_blow() : SpellScriptLoader("spell_warr_concussion_blow") { } + + class spell_warr_concussion_blow_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warr_concussion_blow_SpellScript); + + void HandleDummy(SpellEffIndex /* effIndex */) + { + SetHitDamage(GetHitDamage() + CalculatePctF(GetHitDamage(),GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK))); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_warr_concussion_blow_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warr_concussion_blow_SpellScript(); + } +}; + +enum Bloodthirst +{ + SPELL_BLOODTHIRST = 23885, +}; + +class spell_warr_bloodthirst : public SpellScriptLoader +{ + public: + spell_warr_bloodthirst() : SpellScriptLoader("spell_warr_bloodthirst") { } + + class spell_warr_bloodthirst_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warr_bloodthirst_SpellScript); + + void HandleDummy(SpellEffIndex /* effIndex */) + { + int32 damage = GetEffectValue(); + if (GetHitUnit()) + GetCaster()->CastCustomSpell(GetHitUnit(), SPELL_BLOODTHIRST, &damage, NULL, NULL, true, NULL); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_warr_bloodthirst_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warr_bloodthirst_SpellScript(); + } +}; + void AddSC_warrior_spell_scripts() { new spell_warr_last_stand(); new spell_warr_improved_spell_reflection(); new spell_warr_vigilance(); + new spell_warr_deep_wounds(); + new spell_warr_charge(); + new spell_warr_slam(); + new spell_warr_execute(); + new spell_warr_concussion_blow(); + new spell_warr_bloodthirst(); } -- cgit v1.2.3 From 5411e1ce522b5a6f0faf2575fb96157bedeb5454 Mon Sep 17 00:00:00 2001 From: click Date: Sat, 18 Feb 2012 16:52:08 +0100 Subject: Core: Clean up whitespace and tabs in the base sourcetree --- src/server/collision/DynamicTree.h | 2 +- src/server/collision/Maps/TileAssembler.cpp | 18 ++++++------- src/server/collision/Models/GameObjectModel.cpp | 2 +- src/server/collision/Models/GameObjectModel.h | 4 +-- src/server/collision/RegularGrid.h | 4 +-- src/server/game/AI/SmartScripts/SmartAI.cpp | 10 ++++---- src/server/game/AI/SmartScripts/SmartAI.h | 2 +- src/server/game/AI/SmartScripts/SmartScript.cpp | 2 +- src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 2 +- src/server/game/AI/SmartScripts/SmartScriptMgr.h | 14 +++++----- .../game/Battlegrounds/Zones/BattlegroundRV.cpp | 6 ++--- src/server/game/Chat/Commands/TicketCommands.cpp | 2 +- src/server/game/Conditions/ConditionMgr.cpp | 8 +++--- src/server/game/DungeonFinding/LFGMgr.cpp | 14 +++++----- src/server/game/Entities/GameObject/GameObject.h | 4 +-- src/server/game/Entities/Player/Player.cpp | 2 +- src/server/game/Entities/Unit/Unit.cpp | 2 +- src/server/game/Handlers/AuctionHouseHandler.cpp | 4 +-- src/server/game/Handlers/CalendarHandler.cpp | 4 +-- src/server/game/Handlers/CharacterHandler.cpp | 2 +- src/server/game/Maps/Map.h | 2 +- .../WaypointMovementGenerator.cpp | 10 ++++---- src/server/game/Spells/Auras/SpellAuraEffects.h | 2 +- src/server/game/Spells/Auras/SpellAuras.cpp | 2 +- src/server/game/Spells/Auras/SpellAuras.h | 2 +- src/server/game/World/World.cpp | 2 +- src/server/scripts/Commands/cs_debug.cpp | 2 +- src/server/scripts/Commands/cs_go.cpp | 2 +- .../EasternKingdoms/AlteracValley/boss_vanndar.cpp | 2 +- .../BlackrockDepths/blackrock_depths.cpp | 2 +- .../scripts/EasternKingdoms/arathi_highlands.cpp | 2 +- src/server/scripts/Examples/example_spell.cpp | 4 +-- .../BlackfathomDeeps/blackfathom_deeps.cpp | 6 ++--- .../CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp | 2 +- .../Kalimdor/Maraudon/boss_celebras_the_cursed.cpp | 6 ++--- .../scripts/Kalimdor/Maraudon/boss_landslide.cpp | 6 ++--- .../scripts/Kalimdor/Maraudon/boss_noxxion.cpp | 8 +++--- .../Kalimdor/Maraudon/boss_princess_theradras.cpp | 8 +++--- src/server/scripts/Kalimdor/desolace.cpp | 2 +- .../IcecrownCitadel/icecrown_citadel_teleport.cpp | 2 +- .../scripts/Northrend/Nexus/Oculus/boss_urom.cpp | 2 +- .../scripts/Northrend/Nexus/Oculus/oculus.cpp | 2 +- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 2 +- .../scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp | 2 +- .../UtgardeKeep/UtgardeKeep/boss_keleseth.cpp | 4 +-- .../UtgardeKeep/UtgardePinnacle/boss_svala.cpp | 30 +++++++++++----------- src/server/scripts/Northrend/dalaran.cpp | 2 +- src/server/scripts/Northrend/sholazar_basin.cpp | 2 +- .../scripts/Outland/blades_edge_mountains.cpp | 2 +- src/server/scripts/Spells/spell_dk.cpp | 8 +++--- src/server/scripts/Spells/spell_generic.cpp | 2 +- src/server/scripts/Spells/spell_hunter.cpp | 6 ++--- src/server/scripts/Spells/spell_item.cpp | 12 ++++----- src/server/scripts/Spells/spell_mage.cpp | 2 +- src/server/scripts/Spells/spell_priest.cpp | 2 +- src/server/scripts/Spells/spell_quest.cpp | 2 +- src/server/scripts/Spells/spell_rogue.cpp | 4 +-- src/server/scripts/Spells/spell_shaman.cpp | 6 ++--- src/server/scripts/Spells/spell_warlock.cpp | 4 +-- src/server/scripts/Spells/spell_warrior.cpp | 2 +- src/server/scripts/World/go_scripts.cpp | 2 +- .../Database/Implementation/CharacterDatabase.h | 2 +- src/server/shared/Threading/Callback.h | 2 +- 63 files changed, 143 insertions(+), 143 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/collision/DynamicTree.h b/src/server/collision/DynamicTree.h index 0b4f5908c04..079c0adbf5e 100644 --- a/src/server/collision/DynamicTree.h +++ b/src/server/collision/DynamicTree.h @@ -16,7 +16,7 @@ * with this program. If not, see . */ - + #ifndef _DYNTREE_H #define _DYNTREE_H diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp index cfd50c318df..68ea3ec80cd 100644 --- a/src/server/collision/Maps/TileAssembler.cpp +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -258,7 +258,7 @@ namespace VMAP uint32 groups = raw_model.groupsArray.size(); if (groups != 1) printf("Warning: '%s' does not seem to be a M2 model!\n", modelFilename.c_str()); - + AABox modelBound; bool boundEmpty=true; @@ -308,7 +308,7 @@ namespace VMAP WorldModel_Raw raw_model; if (!raw_model.Read(filename.c_str())) return false; - + // write WorldModel WorldModel model; model.setRootWmoID(raw_model.RootWMOID); @@ -327,12 +327,12 @@ namespace VMAP model.setGroupModels(groupsArray); } - + success = model.writeFile(iDestDir + "/" + pModelFilename + ".vmo"); //std::cout << "readRawFile2: '" << pModelFilename << "' tris: " << nElements << " nodes: " << nNodes << std::endl; return success; } - + void TileAssembler::exportGameobjectModels() { FILE* model_list = fopen((iSrcDir + "/" + GAMEOBJECT_MODELS).c_str(), "rb"); @@ -405,13 +405,13 @@ namespace VMAP READ_OR_RETURN(&mogpflags, sizeof(uint32)); READ_OR_RETURN(&GroupWMOID, sizeof(uint32)); - + Vector3 vec1, vec2; READ_OR_RETURN(&vec1, sizeof(Vector3)); READ_OR_RETURN(&vec2, sizeof(Vector3)); bounds.set(vec1, vec2); - + READ_OR_RETURN(&liquidflags, sizeof(uint32)); // will this ever be used? what is it good for anyway?? @@ -475,7 +475,7 @@ namespace VMAP size = hlq.xtiles*hlq.ytiles; READ_OR_RETURN(liquid->GetFlagsStorage(), size); } - + return true; } @@ -484,7 +484,7 @@ namespace VMAP { delete liquid; } - + bool WorldModel_Raw::Read(const char * path) { FILE* rf = fopen(path, "rb"); @@ -493,7 +493,7 @@ namespace VMAP printf("ERROR: Can't open raw model file: %s\n", path); return false; } - + char ident[8]; int readOperation = 0; diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index 4c0a344f868..1abbc59a5b0 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ - + #include "VMapFactory.h" #include "VMapManager2.h" #include "VMapDefinitions.h" diff --git a/src/server/collision/Models/GameObjectModel.h b/src/server/collision/Models/GameObjectModel.h index 413061c0de0..0bb6c0f47bc 100644 --- a/src/server/collision/Models/GameObjectModel.h +++ b/src/server/collision/Models/GameObjectModel.h @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ - + #ifndef _GAMEOBJECT_MODEL_H #define _GAMEOBJECT_MODEL_H @@ -57,7 +57,7 @@ public: const G3D::Vector3& getPosition() const { return iPos;} - /** Enables\disables collision. */ + /** Enables\disables collision. */ void disable() { phasemask = 0;} void enable(uint32 ph_mask) { phasemask = ph_mask;} diff --git a/src/server/collision/RegularGrid.h b/src/server/collision/RegularGrid.h index 2c11b1c257d..2867b29cfc1 100644 --- a/src/server/collision/RegularGrid.h +++ b/src/server/collision/RegularGrid.h @@ -135,7 +135,7 @@ public: float ky_inv = ray.invDirection().y, by = ray.origin().y; int stepX, stepY; - float tMaxX, tMaxY; + float tMaxX, tMaxY; if (kx_inv >= 0) { stepX = 1; @@ -215,4 +215,4 @@ public: #undef CELL_SIZE #undef HGRID_MAP_SIZE -#endif +#endif diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 07a8e3fdca7..7838e6891fe 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -450,7 +450,7 @@ void SmartAI::EnterEvadeMode() return; RemoveAuras(); - + me->DeleteThreatList(); me->CombatStop(true); me->LoadCreaturesAddon(); @@ -480,15 +480,15 @@ void SmartAI::MoveInLineOfSight(Unit* who) { if (!who) return; - + GetScript()->OnMoveInLineOfSight(who); - + if (me->HasReactState(REACT_PASSIVE) || AssistPlayerInCombat(who)) return; if (!CanAIAttack(who)) return; - + if (!me->canStartAttack(who, false)) return; @@ -827,7 +827,7 @@ void SmartAI::SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker) GetScript()->mLastInvoker = invoker->GetGUID(); GetScript()->SetScript9(e, entry); } - + void SmartAI::sOnGameEvent(bool start, uint16 eventId) { GetScript()->ProcessEventsFor(start ? SMART_EVENT_GAME_EVENT_START : SMART_EVENT_GAME_EVENT_END, NULL, eventId); diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index a40254fe384..e82b35ec87a 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -195,7 +195,7 @@ class SmartAI : public CreatureAI mDespawnState = t ? 1 : 0; } void StartDespawn() { mDespawnState = 2; } - + void RemoveAuras(); private: diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index c716741371e..ae2558830b5 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -88,7 +88,7 @@ void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint3 ConditionList conds = sConditionMgr->GetConditionsForSmartEvent((*i).entryOrGuid, (*i).event_id, (*i).source_type); ConditionSourceInfo info = ConditionSourceInfo(unit, GetBaseObject()); meets = sConditionMgr->IsObjectMeetToConditions(info, conds); - + if (meets) ProcessEvent(*i, unit, var0, var1, bvar, spell, gob); } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 9a23d9e1390..f99e317454c 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -260,7 +260,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e) } case SMART_TARGET_GAMEOBJECT_GUID: { - if (e.target.goGUID.entry && !IsGameObjectValid(e, e.target.goGUID.entry)) + if (e.target.goGUID.entry && !IsGameObjectValid(e, e.target.goGUID.entry)) return false; break; } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index e08fe331d3d..5cc7d0e716c 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -154,7 +154,7 @@ enum SMART_EVENT SMART_EVENT_IS_BEHIND_TARGET = 67, //1 // cooldownMin, CooldownMax SMART_EVENT_GAME_EVENT_START = 68, //1 // game_event.Entry SMART_EVENT_GAME_EVENT_END = 69, //1 // game_event.Entry - SMART_EVENT_GO_STATE_CHANGED = 70, // go state + SMART_EVENT_GO_STATE_CHANGED = 70, // go state SMART_EVENT_END = 71, }; @@ -341,16 +341,16 @@ struct SmartEvent uint32 cooldownMax; } behindTarget; - struct + struct { uint32 gameEventId; } gameEvent; - + struct { uint32 state; } goStateChanged; - + struct { uint32 param1; @@ -872,7 +872,7 @@ struct SmartAction { uint32 goRespawnTime; } RespawnTarget; - + struct { uint32 gossipMenuId; @@ -883,12 +883,12 @@ struct SmartAction { uint32 state; } setGoLootState; - + struct { uint32 id; } sendTargetToTarget; - + struct { uint32 param1; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 3c3d5e1655b..98bb704661e 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -102,7 +102,7 @@ void BattlegroundRV::StartingEventOpenDoors() setState(BG_RV_STATE_OPEN_FENCES); setTimer(BG_RV_FIRST_TIMER); - + TogglePillarCollision(true); } @@ -239,11 +239,11 @@ void BattlegroundRV::TogglePillarCollision(bool apply) if (gob->GetGOInfo()->door.startOpen) _state = GO_STATE_ACTIVE; gob->SetGoState(apply ? (GOState)_state : (GOState)(!_state)); - + if (gob->GetGOInfo()->door.startOpen) gob->EnableCollision(!apply); // Forced collision toggle } - + for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER))) gob->SendUpdateToPlayer(player); diff --git a/src/server/game/Chat/Commands/TicketCommands.cpp b/src/server/game/Chat/Commands/TicketCommands.cpp index 138466f9623..177899efbf0 100755 --- a/src/server/game/Chat/Commands/TicketCommands.cpp +++ b/src/server/game/Chat/Commands/TicketCommands.cpp @@ -257,7 +257,7 @@ bool ChatHandler::HandleGMTicketUnAssignCommand(const char* args) ticket->SaveToDB(trans); sTicketMgr->UpdateLastChange(); - std::string msg = ticket->FormatMessageString(*this, NULL, ticket->GetAssignedToName().c_str(), + std::string msg = ticket->FormatMessageString(*this, NULL, ticket->GetAssignedToName().c_str(), m_session ? m_session->GetPlayer()->GetName() : "Console", NULL); SendGlobalGMSysMessage(msg.c_str()); return true; diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 320a02a30ed..ea4a52f0612 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -193,7 +193,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) case CONDITION_OBJECT_ENTRY: { if (object->GetTypeId() == ConditionValue1) - condMeets = (!ConditionValue2) || (object->GetEntry() == ConditionValue2); + condMeets = (!ConditionValue2) || (object->GetEntry() == ConditionValue2); break; } case CONDITION_TYPE_MASK: @@ -302,8 +302,8 @@ uint32 Condition::GetMaxAvailableConditionTargets() case CONDITION_SOURCE_TYPE_GOSSIP_MENU: case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION: return 2; - case CONDITION_SOURCE_TYPE_SMART_EVENT: - return 2; + case CONDITION_SOURCE_TYPE_SMART_EVENT: + return 2; default: return 1; } @@ -1437,7 +1437,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) return false; } if (cond->ConditionValue3) - sLog->outErrorDb("ObjectEntry condition has useless data in value3 (%u)!", cond->ConditionValue3); + sLog->outErrorDb("ObjectEntry condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_TYPE_MASK: diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index cccb780e412..e6039880b63 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -83,12 +83,12 @@ void LFGMgr::_LoadFromDB(Field* fields, uint64 guid) uint32 dungeon = fields[16].GetUInt32(); uint8 state = fields[17].GetUInt8(); - + if (!dungeon || !state) return; SetDungeon(guid, dungeon); - + switch (state) { case LFG_STATE_DUNGEON: @@ -104,19 +104,19 @@ void LFGMgr::_SaveToDB(uint64 guid, uint32 db_guid) { if (!IS_GROUP(guid)) return; - + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_LFG_DATA); stmt->setUInt32(0, db_guid); CharacterDatabase.Execute(stmt); - + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_LFG_DATA); stmt->setUInt32(0, db_guid); - + stmt->setUInt32(1, GetDungeon(guid)); stmt->setUInt32(2, GetState(guid)); - + CharacterDatabase.Execute(stmt); } @@ -999,7 +999,7 @@ bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposal*& pProposal) LfgQueueInfo* queue = itQueue->second; if (!queue) continue; - + for (LfgRolesMap::const_iterator itPlayer = queue->roles.begin(); itPlayer != queue->roles.end(); ++itPlayer) { if (*itPlayers == ObjectAccessor::FindPlayer(itPlayer->first)) diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index a4635ca6dfb..a4fece4d301 100755 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -710,7 +710,7 @@ class GameObject : public WorldObject, public GridObject uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); } void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); } static void SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid = 0); - + void SetPhaseMask(uint32 newPhaseMask, bool update); void EnableCollision(bool enable); @@ -795,7 +795,7 @@ class GameObject : public WorldObject, public GridObject std::string GetAIName() const; void SetDisplayId(uint32 displayid); - + GameObjectModel * m_model; protected: bool AIM_Initialize(); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 941d898c1fb..42c0823c3da 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -14828,7 +14828,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver) uint16 log_slot = FindQuestSlot(0); if (log_slot >= MAX_QUEST_LOG_SIZE) // Player does not have any free slot in the quest log - return; + return; uint32 quest_id = quest->GetQuestId(); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 4670a976e42..91263882a8c 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -14826,7 +14826,7 @@ Unit* Unit::SelectNearbyTarget(Unit* exclude, float dist) const // remove current target if (getVictim()) targets.remove(getVictim()); - + if (exclude) targets.remove(exclude); diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 5a5ae0325e3..f99bfe52df3 100755 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -128,7 +128,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR); return; } - + for (uint32 i = 0; i < itemsCount; ++i) { recv_data >> itemGUIDs[i]; @@ -188,7 +188,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) return; } - if (sAuctionMgr->GetAItem(item->GetGUIDLow()) || !item->CanBeTraded() || item->IsNotEmptyBag() || + if (sAuctionMgr->GetAItem(item->GetGUIDLow()) || !item->CanBeTraded() || item->IsNotEmptyBag() || item->GetTemplate()->Flags & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION) || item->GetCount() < count[i]) { diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index be547c84b19..820079a90e1 100755 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -88,7 +88,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/) data << uint32(counter); // raid reset count std::set sentMaps; - + ResetTimeByMapDifficultyMap const& resets = sInstanceSaveMgr->GetResetTimeMap(); for (ResetTimeByMapDifficultyMap::const_iterator itr = resets.begin(); itr != resets.end(); ++itr) { @@ -102,7 +102,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/) continue; sentMaps.insert(mapId); - + data << uint32(mapId); data << uint32(itr->second - cur_time); data << uint32(mapEntry->unk_time); diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index d677424496a..a48cf70bd54 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -197,7 +197,7 @@ bool LoginQueryHolder::Initialize() stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_INSTANCELOCKTIMES); stmt->setUInt32(0, m_accountId); res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOADINSTANCELOCKTIMES, stmt); - + return res; } diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 9f4dbb23b63..d8db4c947a3 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -171,7 +171,7 @@ class GridMap uint8 _liquidOffY; uint8 _liquidWidth; uint8 _liquidHeight; - + bool loadAreaData(FILE* in, uint32 offset, uint32 size); bool loadHeihgtData(FILE* in, uint32 offset, uint32 size); diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 1871454d614..fb2249c508e 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -111,8 +111,8 @@ bool WaypointMovementGenerator::StartMove(Creature &creature) m_isArrivalDone = false; - creature.AddUnitState(UNIT_STATE_ROAMING_MOVE); - + creature.AddUnitState(UNIT_STATE_ROAMING_MOVE); + Movement::MoveSplineInit init(creature); init.MoveTo(node->x, node->y, node->z); @@ -147,7 +147,7 @@ bool WaypointMovementGenerator::Update(Creature &creature, const uint3 if (CanMove(diff)) return StartMove(creature); } - else + else { if (creature.IsStopped()) Stop(STOP_TIME_FOR_PLAYER); @@ -155,7 +155,7 @@ bool WaypointMovementGenerator::Update(Creature &creature, const uint3 { OnArrived(creature); return StartMove(creature); - } + } } return true; } @@ -293,7 +293,7 @@ bool FlightPathMovementGenerator::GetResetPosition(Player&, float& x, float& y, x = node.x; y = node.y; z = node.z; return true; } - + void FlightPathMovementGenerator::InitEndGridInfo() { /*! Storage to preload flightmaster grid at end of flight. For multi-stop flights, this will diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index 490f33f46e1..64079918638 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -104,7 +104,7 @@ class AuraEffect int32 m_periodicTimer; int32 m_amplitude; uint32 m_tickNumber; - + uint8 const m_effIndex; bool m_canBeRecalculated; bool m_isPeriodic; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 1260425ef55..5329c1a0914 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -2045,7 +2045,7 @@ void Aura::TriggerProcOnEvent(AuraApplication* aurApp, ProcEventInfo& eventInfo) if (aurApp->HasEffect(i)) // TODO: OnEffectProc hook here (allowing prevention of selected effects) GetEffect(i)->HandleProc(aurApp, eventInfo); - // TODO: AfterEffectProc hook here + // TODO: AfterEffectProc hook here // TODO: AfterProc hook here diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 0af8d132211..79a068589f9 100755 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -186,7 +186,7 @@ class Aura bool CanStackWith(Aura const* existingAura) const; // Proc system - // this subsystem is not yet in use - the core of it is functional, but still some research has to be done + // this subsystem is not yet in use - the core of it is functional, but still some research has to be done // and some dependant problems fixed before it can replace old proc system (for example cooldown handling) // currently proc system functionality is implemented in Unit::ProcDamageAndSpell bool IsProcOnCooldown() const; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 354b36ba93b..a31f2618d61 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1276,7 +1276,7 @@ void World::SetInitialWorldSettings() sLog->outString("Loading GameObject models..."); LoadGameObjectModelList(); - + sLog->outString("Loading Script Names..."); sObjectMgr->LoadScriptNames(); diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 3de1181f764..8ca40231090 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1041,7 +1041,7 @@ public: handler->GetSession()->GetPlayer()->HandleEmoteCommand(animId); return true; } - + static bool HandleDebugLoSCommand(ChatHandler* handler, char const* /*args*/) { if (Unit* unit = handler->getSelectedUnit()) diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index 3de0d89bac5..f7371884da2 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -496,7 +496,7 @@ public: float z; float ort = port ? (float)atof(port) : player->GetOrientation(); uint32 mapId = id ? (uint32)atoi(id) : player->GetMapId(); - + if (goZ) { z = (float)atof(goZ); diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp index 54fcb9d99c2..3960351d395 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp @@ -24,7 +24,7 @@ enum Yells YELL_RESPAWN1 = -1810010, // no creature_text YELL_RESPAWN2 = -1810011, // no creature_text YELL_RANDOM = 2, - YELL_SPELL = 3, + YELL_SPELL = 3, }; enum Spells diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp index 17cf775603f..7ef11e5256a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp @@ -1301,7 +1301,7 @@ void AddSC_blackrock_depths() new npc_kharan_mighthammer(); new npc_lokhtos_darkbargainer(); new npc_rocknot(); - // Fix us + // Fix us /*new npc_dughal_stormwing(); new npc_tobias_seecher(); new npc_marshal_windsor(); diff --git a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp index e2a9717882b..82b09b9dc18 100644 --- a/src/server/scripts/EasternKingdoms/arathi_highlands.cpp +++ b/src/server/scripts/EasternKingdoms/arathi_highlands.cpp @@ -73,7 +73,7 @@ class npc_professor_phizzlethorpe : public CreatureScript switch (uiPointId) { - case 4:Talk(SAY_PROGRESS_2, player->GetGUID());break; + case 4:Talk(SAY_PROGRESS_2, player->GetGUID());break; case 5:Talk(SAY_PROGRESS_3, player->GetGUID());break; case 8:Talk(EMOTE_PROGRESS_4);break; case 9: diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index b1a8f17d16a..71dbd7f4fb0 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -93,14 +93,14 @@ class spell_ex_5581 : public SpellScriptLoader void HandleAfterCast() { sLog->outString("All immediate actions for the spell are finished now"); - // this is a safe for triggering additional effects for a spell without interfering + // this is a safe for triggering additional effects for a spell without interfering // with visuals or with other effects of the spell //GetCaster()->CastSpell(target, SPELL_TRIGGERED, true); } SpellCastResult CheckRequirement() { - // in this hook you can add additional requirements for spell caster (and throw a client error if reqs're not passed) + // in this hook you can add additional requirements for spell caster (and throw a client error if reqs're not passed) // in this case we're disallowing to select non-player as a target of the spell //if (!GetTargetUnit() || GetTargetUnit()->ToPlayer()) //return SPELL_FAILED_BAD_TARGETS; diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp index 878116ad476..3bfaa448b85 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp @@ -165,14 +165,14 @@ public: DoCast(target, SPELL_FROST_BOLT_VOLLEY); } frostBoltVolleyTimer = urand(5000, 8000); - } + } else frostBoltVolleyTimer -= diff; - + if (frostNovaTimer <= diff) { DoCastAOE(SPELL_FROST_NOVA, false); frostNovaTimer = urand(25000, 30000); - } + } else frostNovaTimer -= diff; break; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index 0caec3c7069..107c9e8f2f9 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -947,7 +947,7 @@ void hyjalAI::HideNearPos(float x, float y) Trinity::AllFriendlyCreaturesInGrid creature_check(me); Trinity::CreatureListSearcher creature_searcher(me, creatures, creature_check); - TypeContainerVisitor , GridTypeMapContainer> creature_visitor(creature_searcher); + TypeContainerVisitor , GridTypeMapContainer> creature_visitor(creature_searcher); cell.Visit(pair, creature_visitor, *(me->GetMap()), *me, me->GetGridActivationRange()); if (!creatures.empty()) diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp index 74e7a919263..38d9ce31563 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp @@ -77,7 +77,7 @@ public: if (target) DoCast(target, SPELL_WRATH); Wrath_Timer = 8000; - } + } else Wrath_Timer -= diff; //EntanglingRoots @@ -85,7 +85,7 @@ public: { DoCast(me->getVictim(), SPELL_ENTANGLINGROOTS); EntanglingRoots_Timer = 20000; - } + } else EntanglingRoots_Timer -= diff; //CorruptForces @@ -94,7 +94,7 @@ public: me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_CORRUPT_FORCES); CorruptForces_Timer = 20000; - } + } else CorruptForces_Timer -= diff; DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp index 418bf3a09ce..ea419793ae8 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp @@ -71,7 +71,7 @@ public: { DoCast(me->getVictim(), SPELL_KNOCKAWAY); KnockAway_Timer = 15000; - } + } else KnockAway_Timer -= diff; //Trample_Timer @@ -79,7 +79,7 @@ public: { DoCast(me, SPELL_TRAMPLE); Trample_Timer = 8000; - } + } else Trample_Timer -= diff; //Landslide @@ -90,7 +90,7 @@ public: me->InterruptNonMeleeSpells(false); DoCast(me, SPELL_LANDSLIDE); Landslide_Timer = 60000; - } + } else Landslide_Timer -= diff; } diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp index 0e3ee5dc52b..18ce7be0f0a 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp @@ -80,7 +80,7 @@ public: me->SetDisplayId(11172); Invisible = false; //me->m_canMove = true; - } + } else if (Invisible) { Invisible_Timer -= diff; @@ -97,7 +97,7 @@ public: { DoCast(me->getVictim(), SPELL_TOXICVOLLEY); ToxicVolley_Timer = 9000; - } + } else ToxicVolley_Timer -= diff; //Uppercut_Timer @@ -105,7 +105,7 @@ public: { DoCast(me->getVictim(), SPELL_UPPERCUT); Uppercut_Timer = 12000; - } + } else Uppercut_Timer -= diff; //Adds_Timer @@ -127,7 +127,7 @@ public: Invisible_Timer = 15000; Adds_Timer = 40000; - } + } else Adds_Timer -= diff; DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp index bade5655f36..039d30071d2 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp @@ -77,7 +77,7 @@ public: { DoCast(me, SPELL_DUSTFIELD); Dustfield_Timer = 14000; - } + } else Dustfield_Timer -= diff; //Boulder_Timer @@ -88,7 +88,7 @@ public: if (target) DoCast(target, SPELL_BOULDER); Boulder_Timer = 10000; - } + } else Boulder_Timer -= diff; //RepulsiveGaze_Timer @@ -96,7 +96,7 @@ public: { DoCast(me->getVictim(), SPELL_REPULSIVEGAZE); RepulsiveGaze_Timer = 20000; - } + } else RepulsiveGaze_Timer -= diff; //Thrash_Timer @@ -104,7 +104,7 @@ public: { DoCast(me, SPELL_THRASH); Thrash_Timer = 18000; - } + } else Thrash_Timer -= diff; DoMeleeAttackIfReady(); diff --git a/src/server/scripts/Kalimdor/desolace.cpp b/src/server/scripts/Kalimdor/desolace.cpp index 421a1d7b38a..49a9be21a98 100644 --- a/src/server/scripts/Kalimdor/desolace.cpp +++ b/src/server/scripts/Kalimdor/desolace.cpp @@ -175,7 +175,7 @@ public: ## Hand of Iruxos ######*/ -enum +enum { QUEST_HAND_IRUXOS = 5381, NPC_DEMON_SPIRIT = 11876, diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp index 0266db5f26b..af8aba57a6d 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp @@ -84,7 +84,7 @@ class at_frozen_throne_teleport : public AreaTriggerScript Spell::SendCastResult(player, spell, 0, SPELL_FAILED_AFFECTING_COMBAT); return true; } - + if (InstanceScript* instance = player->GetInstanceScript()) if (instance->GetBossState(DATA_PROFESSOR_PUTRICIDE) == DONE && instance->GetBossState(DATA_BLOOD_QUEEN_LANA_THEL) == DONE && diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index aef959aad70..9671d59bcec 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -289,7 +289,7 @@ public: void JustDied(Unit* /*killer*/) { _JustDied(); - DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur + DoCast(me, SPELL_DEATH_SPELL, true); // we cast the spell as triggered or the summon effect does not occur } void LeaveCombat() diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index c687aad8bd2..11433bfde37 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -201,7 +201,7 @@ public: Talk(SAY_UROM); me->DespawnOrUnsummon(60000); } - } + } }; CreatureAI* GetAI(Creature* creature) const diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 8c637bc4e90..da46d016e91 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -1670,7 +1670,7 @@ class spell_pursue : public SpellScriptLoader if (Creature* caster = GetCaster()->ToCreature()) caster->AI()->EnterEvadeMode(); } - else + else { //! In the end, only one target should be selected _target = SelectRandomContainerElement(targets); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 12d953a07b4..159e2a9702b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -593,7 +593,7 @@ class boss_freya : public CreatureScript void JustDied(Unit* /*who*/) { //! Freya's chest is dynamically spawned on death by different spells. - const uint32 summonSpell[2][4] = + const uint32 summonSpell[2][4] = { /* 0Elder, 1Elder, 2Elder, 3Elder */ /* 10N */ {62950, 62953, 62955, 62957}, diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index 8a6d7f80818..93cc94923db 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -18,7 +18,7 @@ /* ScriptData SDName: Boss_Prince_Keleseth SD%Complete: 100 -SDComment: +SDComment: SDCategory: Utgarde Keep EndScriptData */ @@ -158,7 +158,7 @@ public: { if (data == DATA_ON_THE_ROCKS) return onTheRocks; - + return 0; } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 989e1e57453..915ead98bb7 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -34,7 +34,7 @@ enum Spells SPELL_RITUAL_DISARM = 54159, SPELL_RITUAL_STRIKE_EFF_1 = 48277, SPELL_RITUAL_STRIKE_EFF_2 = 59930, - + SPELL_SUMMONED_VIS = 64446, SPELL_RITUAL_CHANNELER_1 = 48271, SPELL_RITUAL_CHANNELER_2 = 48274, @@ -62,7 +62,7 @@ enum Yells SAY_SLAY = 3, SAY_DEATH = 4, SAY_SACRIFICE_PLAYER = 5, - + // Image of Arthas SAY_DIALOG_OF_ARTHAS_1 = 0, SAY_DIALOG_OF_ARTHAS_2 = 1 @@ -101,7 +101,7 @@ enum SvalaPoint #define DATA_INCREDIBLE_HULK 2043 -static const float spectatorWP[2][3] = +static const float spectatorWP[2][3] = { {296.95f,-312.76f,86.36f}, {297.69f,-275.81f,86.36f} @@ -133,7 +133,7 @@ public: InstanceScript* instance; SummonList summons; SvalaPhase Phase; - + Position pos; float x, y, z; @@ -157,7 +157,7 @@ public: summons.DespawnAll(); me->RemoveAllAuras(); - + if (Phase > INTRO) { me->SetFlying(true); @@ -177,7 +177,7 @@ public: instance->SetData64(DATA_SACRIFICED_PLAYER, 0); } } - + void JustReachedHome() { if (Phase > INTRO) @@ -188,23 +188,23 @@ public: me->SendMovementFlagUpdate(); } } - + void EnterCombat(Unit* /*who*/) { Talk(SAY_AGGRO); - + sinsterStrikeTimer = 7 * IN_MILLISECONDS; callFlamesTimer = urand(10 * IN_MILLISECONDS, 20 * IN_MILLISECONDS); if (instance) instance->SetData(DATA_SVALA_SORROWGRAVE_EVENT, IN_PROGRESS); } - + void JustSummoned(Creature* summon) { if (summon->GetEntry() == CREATURE_RITUAL_CHANNELER) summon->CastSpell(summon, SPELL_SUMMONED_VIS, true); - + summons.Summon(summon); } @@ -222,7 +222,7 @@ public: { Phase = INTRO; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - + if (GameObject* mirror = GetClosestGameObjectWithEntry(me, OBJECT_UTGARDE_MIRROR, 100.0f)) mirror->SetGoState(GO_STATE_READY); @@ -233,13 +233,13 @@ public: } } } - + void KilledUnit(Unit* victim) { if (victim != me) Talk(SAY_SLAY); } - + void DamageTaken(Unit* attacker, uint32 &damage) { if (Phase == SVALADEAD) @@ -532,7 +532,7 @@ public: if (IsHeroic()) DoCast(me, SPELL_SHADOWS_IN_THE_DARK); } - + void UpdateAI(const uint32 diff) { if (me->HasUnitState(UNIT_STATE_CASTING)) @@ -648,7 +648,7 @@ class npc_scourge_hulk : public CreatureScript { return type == DATA_INCREDIBLE_HULK ? killedByRitualStrike : 0; } - + void DamageTaken(Unit* attacker, uint32 &damage) { if (damage >= me->GetHealth() && attacker->GetEntry() == CREATURE_SVALA_SORROWGRAVE) diff --git a/src/server/scripts/Northrend/dalaran.cpp b/src/server/scripts/Northrend/dalaran.cpp index cd3cbf29d0d..258d038ee4b 100644 --- a/src/server/scripts/Northrend/dalaran.cpp +++ b/src/server/scripts/Northrend/dalaran.cpp @@ -75,7 +75,7 @@ public: return; Player* player = who->GetCharmerOrOwnerPlayerOrPlayerItself(); - + if (!player || player->isGameMaster() || player->IsBeingTeleported() || // If player has Disguise aura for quest A Meeting With The Magister or An Audience With The Arcanist, do not teleport it away but let it pass player->HasAura(SPELL_SUNREAVER_DISGUISE_FEMALE) || player->HasAura(SPELL_SUNREAVER_DISGUISE_MALE) || diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index 79e8da6fd77..36dc6177f64 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -676,7 +676,7 @@ enum MiscLifewarden NPC_SERVANT = 28320, // Servant of Freya WHISPER_ACTIVATE = 0, - + SPELL_FREYA_DUMMY = 51318, SPELL_LIFEFORCE = 51395, SPELL_FREYA_DUMMY_TRIGGER = 51335, diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp index c9fdd0f65ff..f99851f013e 100644 --- a/src/server/scripts/Outland/blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/blades_edge_mountains.cpp @@ -977,7 +977,7 @@ class npc_simon_bunny : public CreatureScript uint32 rewSpell = 0; switch (level) { - case 6: + case 6: if (large) GivePunishment(); else diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 2d90b5346a4..3822428cc75 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -698,7 +698,7 @@ class spell_dk_death_strike : public SpellScriptLoader { OnEffectHitTarget += SpellEffectFn(spell_dk_death_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY); } - + }; SpellScript* GetSpellScript() const @@ -747,7 +747,7 @@ class spell_dk_death_coil : public SpellScriptLoader { OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - + }; SpellScript* GetSpellScript() const @@ -776,7 +776,7 @@ class spell_dk_death_grip : public SpellScriptLoader GetSummonPosition(effIndex, pos, 0.0f, 0); if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence - target->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true); + target->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true); } } @@ -784,7 +784,7 @@ class spell_dk_death_grip : public SpellScriptLoader { OnEffectHitTarget += SpellEffectFn(spell_dk_death_grip_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - + }; SpellScript* GetSpellScript() const diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index a34b16a9c22..b6a4ca8ce31 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1599,7 +1599,7 @@ class spell_gen_spirit_healer_res : public SpellScriptLoader { OnEffectHitTarget += SpellEffectFn(spell_gen_spirit_healer_res_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - }; + }; SpellScript* GetSpellScript() const { diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 13ad05b1930..029e571d935 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -50,12 +50,12 @@ class spell_hun_aspect_of_the_beast : public SpellScriptLoader class spell_hun_aspect_of_the_beast_AuraScript : public AuraScript { PrepareAuraScript(spell_hun_aspect_of_the_beast_AuraScript); - + bool Load() { return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - + bool Validate(SpellInfo const* /*entry*/) { if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET)) @@ -506,7 +506,7 @@ class spell_hun_pet_carrion_feeder : public SpellScriptLoader class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript { PrepareSpellScript(spell_hun_pet_carrion_feeder_SpellScript); - + bool Load() { if (!GetCaster()->isPet()) diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 844162a88ec..4f0c389825e 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -813,7 +813,7 @@ class spell_item_book_of_glyph_mastery : public SpellScriptLoader class spell_item_book_of_glyph_mastery_SpellScript : public SpellScript { PrepareSpellScript(spell_item_book_of_glyph_mastery_SpellScript); - + bool Load() { return GetCaster()->GetTypeId() == TYPEID_PLAYER; @@ -1123,7 +1123,7 @@ class spell_item_purify_helboar_meat : public SpellScriptLoader { return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - + bool Validate(SpellInfo const* /*spell*/) { if (!sSpellMgr->GetSpellInfo(SPELL_SUMMON_PURIFIED_HELBOAR_MEAT) || !sSpellMgr->GetSpellInfo(SPELL_SUMMON_TOXIC_HELBOAR_MEAT)) @@ -1162,7 +1162,7 @@ class spell_item_crystal_prison_dummy_dnd : public SpellScriptLoader class spell_item_crystal_prison_dummy_dnd_SpellScript : public SpellScript { PrepareSpellScript(spell_item_crystal_prison_dummy_dnd_SpellScript); - + bool Validate(SpellInfo const* /*spell*/) { if (!sObjectMgr->GetGameObjectTemplate(OBJECT_IMPRISONED_DOOMGUARD)) @@ -1229,7 +1229,7 @@ class spell_item_reindeer_transformation : public SpellScriptLoader caster->RemoveAurasByType(SPELL_AURA_MOUNTED); //5 different spells used depending on mounted speed and if mount can fly or not - + if (flyspeed >= 4.1f) // Flying Reindeer caster->CastSpell(caster, SPELL_FLYING_REINDEER_310, true); //310% flying Reindeer @@ -1328,7 +1328,7 @@ class spell_item_poultryizer : public SpellScriptLoader void HandleDummy(SpellEffIndex /* effIndex */) { - if (GetCastItem() && GetHitUnit()) + if (GetCastItem() && GetHitUnit()) GetCaster()->CastSpell(GetHitUnit(), roll_chance_i(80) ? SPELL_POULTRYIZER_SUCCESS : SPELL_POULTRYIZER_BACKFIRE , true, GetCastItem()); } @@ -1358,7 +1358,7 @@ class spell_item_socrethars_stone : public SpellScriptLoader class spell_item_socrethars_stone_SpellScript : public SpellScript { PrepareSpellScript(spell_item_socrethars_stone_SpellScript); - + bool Load() { return (GetCaster()->GetAreaId() == 3900 || GetCaster()->GetAreaId() == 3742); diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 181b89ed5f8..adbaebdf827 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -87,7 +87,7 @@ class spell_mage_cold_snap : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { - + Player* caster = GetCaster()->ToPlayer(); // immediately finishes the cooldown on Frost spells const SpellCooldowns& cm = caster->GetSpellCooldownMap(); diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index b7793c919b6..b73d858f6a6 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -252,7 +252,7 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader Unit* target = GetTarget(); if (dmgInfo.GetAttacker() == target) return; - + if (Unit* caster = GetCaster()) if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0)) { diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 9b5e2b2ea09..ecd3317d7a7 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -993,7 +993,7 @@ class spell_q14112_14145_chum_the_water: public SpellScriptLoader class spell_q14112_14145_chum_the_water_SpellScript : public SpellScript { PrepareSpellScript(spell_q14112_14145_chum_the_water_SpellScript); - + bool Validate(SpellInfo const* /*spellEntry*/) { if (!sSpellMgr->GetSpellInfo(SUMMON_ANGRY_KVALDIR) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_MAKO) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_THRESHER) || !sSpellMgr->GetSpellInfo(SUMMON_NORTH_SEA_BLUE_SHARK)) diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 0be2bf6b40c..207d047d8db 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -258,7 +258,7 @@ class spell_rog_shiv : public SpellScriptLoader class spell_rog_shiv_SpellScript : public SpellScript { PrepareSpellScript(spell_rog_shiv_SpellScript); - + bool Load() { return GetCaster()->GetTypeId() == TYPEID_PLAYER; @@ -321,7 +321,7 @@ class spell_rog_deadly_poison : public SpellScriptLoader return; Player* player = GetCaster()->ToPlayer(); - + if (Unit* target = GetHitUnit()) { diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index be5d04c1597..f334f8d2264 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -427,7 +427,7 @@ class spell_sha_healing_stream_totem : public SpellScriptLoader { if (triggeringSpell) damage = int32(owner->SpellHealingBonus(target, triggeringSpell, damage, HEAL)); - + // Restorative Totems if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, ICON_ID_RESTORATIVE_TOTEMS, 1)) AddPctN(damage, dummy->GetAmount()); @@ -486,7 +486,7 @@ class spell_sha_mana_spring_totem : public SpellScriptLoader { OnEffectHitTarget += SpellEffectFn(spell_sha_mana_spring_totem_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } - + }; SpellScript* GetSpellScript() const @@ -529,7 +529,7 @@ class spell_sha_lava_lash : public SpellScriptLoader { OnEffectHitTarget += SpellEffectFn(spell_sha_lava_lash_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); } - + }; SpellScript* GetSpellScript() const diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index bf1c205f1af..7a8aa79bec5 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -328,7 +328,7 @@ class spell_warl_soulshatter : public SpellScriptLoader { sLog->outString("THREATREDUCTION"); caster->CastSpell(target, SPELL_SOULSHATTER, true); - } else + } else sLog->outString("can have threat? %b . threat number? %f ",target->CanHaveThreatList(),target->getThreatManager().getThreat(caster)); } @@ -363,7 +363,7 @@ class spell_warl_life_tap : public SpellScriptLoader class spell_warl_life_tap_SpellScript : public SpellScript { PrepareSpellScript(spell_warl_life_tap_SpellScript); - + bool Load() { return GetCaster()->GetTypeId() == TYPEID_PLAYER; diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index cf4c7bfdec8..fa6f96c3c00 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -333,7 +333,7 @@ class spell_warr_execute : public SpellScriptLoader if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_GLYPH_OF_EXECUTION, EFFECT_0)) rageUsed += aurEff->GetAmount() * 10; - + int32 bp = GetEffectValue() + int32(rageUsed * spellInfo->Effects[effIndex].DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f); caster->CastCustomSpell(target,SPELL_EXECUTE,&bp,0,0,true,0,0,GetOriginalCaster()->GetGUID()); } diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index fff01c83d07..3dfc85d7eb4 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -1312,7 +1312,7 @@ class go_veil_skith_cage : public GameObjectScript (*itr)->AI()->Talk(SAY_FREE_0); (*itr)->GetMotionMaster()->Clear(); } - } + } return false; } }; diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index 18b488e055a..ca53712fbaa 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -351,7 +351,7 @@ enum CharacterDatabaseStatements CHAR_DEL_CHARACTER_SOCIAL, CHAR_UPD_CHARACTER_SOCIAL_NOTE, CHAR_UPD_CHARACTER_POSITION, - + CHAR_INS_LFG_DATA, CHAR_DEL_LFG_DATA, diff --git a/src/server/shared/Threading/Callback.h b/src/server/shared/Threading/Callback.h index fd7a1130fb4..3e1e7ac692f 100755 --- a/src/server/shared/Threading/Callback.h +++ b/src/server/shared/Threading/Callback.h @@ -96,7 +96,7 @@ class QueryCallback { return _stage; } - + //! Resets all underlying variables (param, result and stage) void Reset() { -- cgit v1.2.3 From e48290d2ccf0a3ba56451b73f2c971711edba45b Mon Sep 17 00:00:00 2001 From: mweinelt Date: Sat, 18 Feb 2012 23:54:46 +0000 Subject: Scripts/EoE: Fix achievement You Don't Have An Eternity (10+25) Closes #5273 --- .../scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 6dfa62df2d1..437d9980af3 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -31,7 +31,6 @@ Script Data End */ #include "eye_of_eternity.h" #include "ScriptedEscortAI.h" -// not implemented enum Achievements { ACHIEV_TIMED_START_EVENT = 20387, @@ -242,6 +241,9 @@ public: _cannotMove = true; me->SetFlying(true); + + if (instance) + instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } uint32 GetData(uint32 data) @@ -359,7 +361,10 @@ public: Talk(SAY_AGGRO_P_ONE); - DoCast(SPELL_BERSEKER); + DoCast(SPELL_BERSEKER); // periodic aura, first tick in 10 minutes + + if (instance) + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } void KilledUnit(Unit* who) -- cgit v1.2.3 From dce3bc01ac08598404f6c91bcbf1e7c6a03dc6c4 Mon Sep 17 00:00:00 2001 From: click Date: Sun, 19 Feb 2012 16:57:07 +0100 Subject: Core: Fix non-PCH building --- src/server/collision/Models/WorldModel.cpp | 1 + src/server/game/Spells/Auras/SpellAuras.h | 1 + src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp | 4 ++++ src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp | 4 ++++ src/server/scripts/Spells/spell_dk.cpp | 4 +++- src/server/scripts/Spells/spell_druid.cpp | 2 ++ src/server/scripts/Spells/spell_generic.cpp | 5 +++++ src/server/scripts/Spells/spell_hunter.cpp | 7 ++++++- src/server/scripts/Spells/spell_item.cpp | 4 ++++ src/server/scripts/Spells/spell_mage.cpp | 4 ++++ src/server/scripts/Spells/spell_paladin.cpp | 3 ++- src/server/scripts/Spells/spell_priest.cpp | 2 ++ src/server/scripts/Spells/spell_quest.cpp | 3 +++ src/server/scripts/Spells/spell_rogue.cpp | 2 ++ src/server/scripts/Spells/spell_shaman.cpp | 4 ++++ src/server/scripts/Spells/spell_warlock.cpp | 3 ++- src/server/scripts/Spells/spell_warrior.cpp | 3 +++ 17 files changed, 52 insertions(+), 4 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/collision/Models/WorldModel.cpp b/src/server/collision/Models/WorldModel.cpp index b49538a485d..cda34510058 100644 --- a/src/server/collision/Models/WorldModel.cpp +++ b/src/server/collision/Models/WorldModel.cpp @@ -17,6 +17,7 @@ */ #include "WorldModel.h" +#include "ModelInstance.h" #include "VMapDefinitions.h" #include "MapTree.h" diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 79a068589f9..2f50d47a79b 100755 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -21,6 +21,7 @@ #include "SpellAuraDefines.h" #include "SpellInfo.h" +#include "Unit.h" class Unit; class SpellInfo; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp index e308cc59708..e64099da3ac 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_thaddius.cpp @@ -15,6 +15,10 @@ * with this program. If not, see . */ +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" + #include "naxxramas.h" //Stalagg diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index 4917fb25153..05fad24f35e 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -23,6 +23,10 @@ SDComment: SDCategory: Tempest Keep, The Eye EndScriptData */ +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" + #include "the_eye.h" enum eEnums diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 3822428cc75..92fae4e1299 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -21,7 +21,9 @@ * Scriptnames of files in this file should be prefixed with "spell_dk_". */ -#include "Spell.h" +#include "ScriptMgr.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" enum DeathKnightSpells { diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index e26bd2406dd..4c440f18bd9 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -21,6 +21,8 @@ * Scriptnames of files in this file should be prefixed with "spell_dru_". */ +#include "ScriptMgr.h" +#include "SpellScript.h" #include "SpellAuraEffects.h" enum DruidSpells diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index b6a4ca8ce31..3ce7c4b55ee 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -22,9 +22,14 @@ * Scriptnames of files in this file should be prefixed with "spell_gen_" */ +#include "ScriptMgr.h" +#include "SpellScript.h" #include "SpellAuraEffects.h" #include "SkillDiscovery.h" +#include "Cell.h" +#include "CellImpl.h" #include "GridNotifiers.h" +#include "InstanceScript.h" #include "Group.h" #include "LFGMgr.h" diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 029e571d935..dd9bfd90a0b 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -21,8 +21,13 @@ * Scriptnames of files in this file should be prefixed with "spell_hun_". */ -#include "SpellAuraEffects.h" +#include "ScriptMgr.h" +#include "Cell.h" +#include "CellImpl.h" #include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" enum HunterSpells { diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 5343bfbaf5e..7829587b0ea 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -21,6 +21,10 @@ * Scriptnames of files in this file should be prefixed with "spell_item_". */ +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" #include "SkillDiscovery.h" // Generic script for handling item dummy effects which trigger another spell. diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index adbaebdf827..ea1af10816b 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -21,6 +21,10 @@ * Scriptnames of files in this file should be prefixed with "spell_mage_". */ +#include "ScriptMgr.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" + enum MageSpells { diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 0ef158fe4bf..d823c629d4b 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -21,8 +21,9 @@ * Scriptnames of files in this file should be prefixed with "spell_pal_". */ +#include "ScriptMgr.h" +#include "SpellScript.h" #include "SpellAuraEffects.h" -#include "Unit.h" enum PaladinSpells diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index b73d858f6a6..70027ca9fd3 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -21,6 +21,8 @@ * Scriptnames of files in this file should be prefixed with "spell_pri_". */ +#include "ScriptMgr.h" +#include "SpellScript.h" #include "SpellAuraEffects.h" #include "GridNotifiers.h" diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index ecd3317d7a7..6de1ffa8376 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -21,6 +21,9 @@ * Scriptnames of files in this file should be prefixed with "spell_q#questID_". */ +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" #include "Vehicle.h" class spell_generic_quest_update_entry_SpellScript : public SpellScript diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 207d047d8db..3a4132f62fe 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -21,6 +21,8 @@ * Scriptnames of files in this file should be prefixed with "spell_rog_". */ +#include "ScriptMgr.h" +#include "SpellScript.h" #include "SpellAuraEffects.h" enum RogueSpells diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index f334f8d2264..96ee7a18429 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -21,6 +21,10 @@ * Scriptnames of files in this file should be prefixed with "spell_sha_". */ +#include "ScriptMgr.h" +#include "GridNotifiers.h" +#include "Unit.h" +#include "SpellScript.h" #include "SpellAuraEffects.h" enum ShamanSpells diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 7a8aa79bec5..1bb531be4c8 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -21,7 +21,8 @@ * Scriptnames of files in this file should be prefixed with "spell_warl_". */ -#include "Spell.h" +#include "ScriptMgr.h" +#include "SpellScript.h" #include "SpellAuraEffects.h" enum WarlockSpells diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index fa6f96c3c00..1084398c37d 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -21,6 +21,9 @@ * Scriptnames of files in this file should be prefixed with "spell_warr_". */ +#include "ScriptMgr.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" enum WarriorSpells { -- cgit v1.2.3 From f09b5a6bea89da1b73a0beb05b977feba3285562 Mon Sep 17 00:00:00 2001 From: QAston Date: Tue, 21 Feb 2012 20:03:27 +0100 Subject: Core/Db/Conditions: -Drop condition CONDITION_SPELL_SCRIPT_TARGET, use other condition types instead -Change CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET to CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET: --allow using this condition for more spell implicit target types (not just ENTRY) --SourceGroup value for this src type is now effMask and it's now required Core/Spells: Unify the way implicit targets are handled, fully implement some partially implemented target types, fix some minor bugs found on the way, general improvements and cleanup. --- .../world/2012_02_21_00_world_conditions.sql | 3592 ++++++++++++++++++ src/server/game/Conditions/ConditionMgr.cpp | 420 ++- src/server/game/Conditions/ConditionMgr.h | 29 +- src/server/game/Entities/Object/Object.cpp | 12 +- src/server/game/Entities/Object/Object.h | 6 +- src/server/game/Entities/Unit/Unit.cpp | 21 +- src/server/game/Entities/Unit/Unit.h | 1 - src/server/game/Grids/GridDefines.h | 10 + src/server/game/Grids/Notifiers/GridNotifiers.cpp | 13 +- src/server/game/Grids/Notifiers/GridNotifiers.h | 117 +- .../game/Grids/Notifiers/GridNotifiersImpl.h | 111 + src/server/game/Spells/Spell.cpp | 3816 ++++++++++---------- src/server/game/Spells/Spell.h | 192 +- src/server/game/Spells/SpellInfo.cpp | 414 ++- src/server/game/Spells/SpellInfo.h | 31 +- src/server/game/Spells/SpellMgr.cpp | 11 +- src/server/game/Spells/SpellMgr.h | 12 +- src/server/game/Spells/SpellScript.cpp | 5 - src/server/game/Spells/SpellScript.h | 1 - .../TrialOfTheChampion/boss_argent_challenge.cpp | 2 +- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 34 +- src/server/scripts/Spells/spell_generic.cpp | 2 +- src/server/scripts/Spells/spell_hunter.cpp | 2 +- 23 files changed, 6376 insertions(+), 2478 deletions(-) create mode 100644 sql/updates/world/2012_02_21_00_world_conditions.sql (limited to 'src/server/scripts/Northrend') diff --git a/sql/updates/world/2012_02_21_00_world_conditions.sql b/sql/updates/world/2012_02_21_00_world_conditions.sql new file mode 100644 index 00000000000..54685868186 --- /dev/null +++ b/sql/updates/world/2012_02_21_00_world_conditions.sql @@ -0,0 +1,3592 @@ +CREATE TABLE `temp_convert_spells` +( + `id` INT(11), + `effMask` INT(11), + `onlyPlayers` TINYINT(3), + PRIMARY KEY (`id`) +); + +INSERT INTO `temp_convert_spells` VALUES +(46174,1,0), +(78002,1,1), +(78001,1,1), +(78000,1,1), +(77999,1,1), +(77984,1,1), +(76379,1,0), +(76098,1,0), +(76092,1,0), +(75920,1,1), +(75767,1,1), +(75765,1,1), +(75396,1,0), +(75389,1,1), +(75364,1,0), +(75319,1,0), +(75313,1,0), +(75244,1,0), +(75197,1,0), +(75195,1,0), +(75181,1,0), +(75107,1,0), +(75100,1,0), +(75078,1,0), +(75053,1,0), +(75018,1,0), +(74977,1,0), +(74903,1,0), +(74801,1,1), +(74758,1,0), +(74735,1,0), +(74549,1,0), +(74548,1,0), +(74486,1,0), +(74455,1,0), +(74444,1,0), +(74313,1,0), +(74285,1,0), +(74219,1,0), +(74182,1,0), +(74148,1,0), +(74098,1,0), +(74090,1,1), +(74086,1,1), +(74074,1,0), +(74033,1,0), +(73980,1,0), +(73955,1,0), +(73953,1,0), +(73886,1,0), +(73846,1,1), +(73845,1,1), +(73844,1,1), +(73843,1,1), +(73837,1,0), +(73836,1,0), +(73835,1,0), +(73787,1,0), +(73786,1,0), +(73785,1,0), +(73725,1,0), +(73659,1,0), +(73650,1,1), +(73582,1,0), +(73556,1,0), +(73555,1,0), +(73548,1,0), +(73331,1,1), +(73288,1,0), +(73165,1,0), +(73164,1,1), +(73159,1,1), +(73129,1,0), +(73128,1,0), +(73082,1,0), +(73071,1,0), +(73035,1,0), +(72959,1,1), +(72934,1,1), +(72928,1,1), +(72900,1,1), +(72830,1,1), +(72748,1,0), +(72747,1,0), +(72746,1,0), +(72745,1,0), +(72728,1,0), +(72706,1,1), +(72618,1,0), +(72595,1,1), +(72527,1,0), +(72479,1,1), +(72431,1,1), +(72429,1,1), +(72401,1,0), +(72347,1,0), +(72346,1,1), +(72280,1,0), +(72279,1,0), +(72278,1,0), +(72262,1,0), +(72260,1,0), +(72257,1,1), +(72209,1,0), +(72202,1,0), +(72099,1,0), +(72033,1,0), +(72032,1,0), +(72031,1,0), +(71952,1,0), +(71949,1,1), +(71948,1,0), +(71946,1,0), +(71848,1,0), +(71811,1,0), +(71809,1,0), +(71753,1,1), +(71693,1,0), +(71620,1,0), +(71617,1,0), +(71599,1,0), +(71538,1,1), +(71536,1,1), +(71520,1,0), +(71440,1,0), +(71415,1,0), +(71412,1,0), +(71365,1,0), +(71352,1,1), +(71322,1,0), +(71310,1,0), +(71308,1,0), +(71306,1,0), +(71281,1,0), +(71272,1,0), +(71189,1,0), +(71082,1,0), +(71081,1,0), +(71080,1,0), +(71079,1,0), +(71078,1,0), +(71075,1,0), +(71070,1,0), +(71032,1,0), +(71024,1,0), +(70995,1,0), +(70983,1,0), +(70966,1,1), +(70939,1,0), +(70936,1,0), +(70933,1,0), +(70931,1,0), +(70921,1,0), +(70881,1,0), +(70861,1,0), +(70860,1,0), +(70859,1,0), +(70858,1,0), +(70857,1,0), +(70856,1,0), +(70792,1,0), +(70790,1,0), +(70784,1,0), +(70781,1,0), +(70743,1,0), +(70713,1,1), +(70643,1,0), +(70639,1,0), +(70638,1,1), +(70636,1,1), +(70635,1,0), +(70623,1,1), +(70614,1,0), +(70611,1,0), +(70602,1,0), +(70595,1,0), +(70588,1,0), +(70586,1,0), +(70572,1,0), +(70569,1,0), +(70527,1,1), +(70525,1,0), +(70488,1,0), +(70485,1,0), +(70471,1,0), +(70466,1,0), +(70464,1,0), +(70444,1,0), +(70443,1,1), +(70403,1,0), +(70397,1,0), +(70383,1,0), +(70374,1,0), +(70366,1,0), +(70360,1,0), +(70338,1,0), +(70331,1,1), +(70299,1,0), +(70293,1,0), +(70290,1,0), +(70267,1,0), +(70266,1,0), +(70265,1,0), +(70246,1,0), +(70225,1,0), +(70224,1,0), +(70143,1,0), +(70130,1,0), +(70104,1,0), +(70100,1,0), +(70098,1,0), +(70079,1,0), +(70078,1,0), +(70053,1,0), +(70041,1,0), +(70040,1,0), +(70021,1,0), +(69960,1,0), +(69959,1,0), +(69922,1,0), +(69907,1,0), +(69886,1,0), +(69857,1,0), +(69843,1,0), +(69801,1,0), +(69798,1,0), +(69796,1,0), +(69784,1,0), +(69782,1,0), +(69768,1,0), +(69753,1,0), +(69705,1,0), +(69682,1,0), +(69614,1,0), +(69610,1,0), +(69601,1,0), +(69600,1,0), +(69593,1,0), +(69553,1,0), +(69538,1,0), +(69508,1,0), +(69431,1,0), +(69372,1,0), +(69347,1,0), +(69298,1,1), +(69171,1,0), +(69125,1,0), +(69101,1,0), +(69098,1,0), +(69097,1,0), +(69048,1,1), +(69039,1,0), +(69016,1,0), +(68957,1,0), +(68922,1,0), +(68919,1,0), +(68901,1,0), +(68881,1,0), +(68880,1,0), +(68861,1,0), +(68847,1,0), +(68842,1,0), +(68798,1,0), +(68663,1,0), +(68644,1,0), +(68617,1,0), +(68616,1,0), +(68614,1,0), +(68515,1,1), +(68471,1,1), +(68470,1,1), +(68401,1,0), +(68400,1,0), +(68360,1,0), +(68359,1,0), +(68358,1,0), +(68206,1,1), +(68198,1,1), +(68197,1,1), +(68193,1,1), +(68186,1,1), +(67888,1,0), +(67864,1,0), +(67857,1,0), +(67856,1,0), +(67855,1,0), +(67804,1,0), +(67757,1,0), +(67756,1,0), +(67755,1,0), +(67748,1,0), +(67732,1,0), +(67715,1,0), +(67705,1,0), +(67551,1,1), +(67547,1,0), +(67482,1,0), +(67400,1,0), +(67397,1,0), +(67369,1,0), +(67335,1,0), +(67328,1,0), +(67163,1,0), +(67162,1,0), +(67161,1,0), +(67160,1,0), +(67159,1,0), +(67158,1,0), +(66986,1,1), +(66810,1,1), +(66798,1,0), +(66785,1,0), +(66774,1,0), +(66718,1,1), +(66665,1,0), +(66637,1,0), +(66636,1,0), +(66630,1,0), +(66551,1,0), +(66550,1,0), +(66513,1,0), +(66512,1,0), +(66508,1,0), +(66401,1,0), +(66391,1,0), +(66390,1,0), +(66387,1,0), +(66386,1,0), +(66385,1,0), +(66384,1,0), +(66383,1,0), +(66382,1,0), +(66379,1,0), +(66357,1,0), +(66356,1,0), +(66355,1,0), +(66354,1,0), +(66353,1,0), +(66352,1,0), +(66350,1,0), +(66349,1,0), +(66348,1,0), +(66345,1,0), +(66339,1,0), +(66332,1,0), +(66314,1,1), +(66312,1,1), +(66287,1,0), +(66256,1,0), +(66193,1,0), +(66181,1,0), +(66153,1,0), +(66152,1,0), +(66141,1,0), +(66140,1,0), +(66135,1,1), +(66133,1,0), +(66132,1,0), +(65872,1,0), +(65861,1,0), +(65719,1,0), +(65718,1,0), +(65699,1,0), +(65685,1,0), +(65652,1,0), +(65614,1,0), +(65613,1,0), +(65611,1,0), +(65594,1,1), +(65589,1,0), +(65588,1,0), +(65587,1,0), +(65509,1,0), +(65357,1,0), +(65354,1,0), +(65350,1,0), +(65349,1,0), +(65346,1,1), +(65312,1,1), +(65311,1,1), +(65265,1,0), +(65258,1,0), +(65238,1,0), +(65224,1,0), +(65206,1,0), +(65200,1,0), +(65192,1,0), +(65184,1,1), +(65140,1,0), +(65109,1,0), +(65061,1,0), +(65042,1,0), +(65040,1,1), +(65034,1,0), +(65016,1,0), +(65015,1,0), +(64996,1,0), +(64995,1,0), +(64898,1,0), +(64887,1,0), +(64886,1,0), +(64880,1,0), +(64828,1,0), +(64799,1,0), +(64767,1,0), +(64623,1,0), +(64620,1,0), +(64619,1,0), +(64618,1,0), +(64597,1,0), +(64543,1,0), +(64539,1,0), +(64503,1,0), +(64499,1,0), +(64480,1,0), +(64475,1,0), +(64474,1,0), +(64466,1,0), +(64465,1,0), +(64463,1,0), +(64449,1,0), +(64444,1,0), +(64425,1,0), +(64414,1,0), +(64402,1,0), +(64397,1,0), +(64320,1,0), +(64229,1,0), +(64225,1,0), +(64224,1,0), +(64201,1,0), +(64185,1,0), +(64184,1,0), +(64183,1,0), +(64173,1,0), +(64172,1,0), +(64098,1,0), +(64069,1,0), +(64063,1,0), +(64061,1,0), +(64059,1,1), +(64032,1,0), +(64031,1,0), +(64030,1,0), +(64029,1,0), +(64028,1,0), +(64027,1,0), +(64026,1,0), +(64025,1,0), +(64024,1,0), +(64014,1,0), +(63984,1,0), +(63979,1,0), +(63947,1,0), +(63886,1,0), +(63882,1,0), +(63820,1,0), +(63813,1,0), +(63812,1,0), +(63764,1,0), +(63763,1,0), +(63762,1,0), +(63761,1,0), +(63749,1,0), +(63747,1,1), +(63745,1,1), +(63744,1,0), +(63702,1,0), +(63676,1,0), +(63659,1,0), +(63658,1,0), +(63657,1,0), +(63629,1,0), +(63628,1,0), +(63576,1,0), +(63524,1,0), +(63499,1,0), +(63446,1,0), +(63445,1,0), +(63444,1,0), +(63443,1,0), +(63442,1,0), +(63441,1,0), +(63440,1,0), +(63439,1,0), +(63438,1,0), +(63352,1,0), +(63348,1,0), +(63322,1,1), +(63274,1,0), +(63255,1,0), +(63238,1,0), +(63109,1,0), +(63037,1,0), +(63013,1,0), +(63001,1,0), +(62990,1,0), +(62978,1,0), +(62976,1,0), +(62943,1,0), +(62911,1,0), +(62909,1,0), +(62906,1,0), +(62888,1,0), +(62883,1,0), +(62882,1,0), +(62834,1,0), +(62809,1,0), +(62797,1,1), +(62778,1,0), +(62731,1,0), +(62727,1,0), +(62711,1,0), +(62708,1,0), +(62706,1,0), +(62701,1,0), +(62669,1,0), +(62646,1,0), +(62603,1,0), +(62584,1,0), +(62577,1,0), +(62567,1,0), +(62533,1,0), +(62525,1,0), +(62524,1,0), +(62521,1,0), +(62509,1,0), +(62505,1,0), +(62496,1,0), +(62488,1,0), +(62485,1,0), +(62484,1,0), +(62483,1,0), +(62480,1,0), +(62464,1,0), +(62378,1,0), +(124,1,0), +(2222,1,0), +(3730,1,0), +(4020,1,0), +(4338,1,0), +(5249,1,0), +(5251,1,0), +(5432,1,0), +(5555,1,0), +(6636,1,0), +(6672,1,0), +(6755,1,0), +(6955,1,0), +(6967,1,0), +(7022,1,0), +(7035,1,0), +(7036,1,0), +(7277,1,0), +(7393,1,0), +(7670,1,0), +(7769,1,0), +(8283,1,0), +(8593,1,0), +(8596,1,0), +(9002,1,0), +(9003,1,0), +(9004,1,0), +(9012,1,0), +(9082,1,0), +(9095,1,0), +(9455,1,0), +(9457,1,0), +(9712,1,0), +(9976,1,0), +(10113,1,0), +(10137,1,0), +(10252,1,0), +(10258,1,0), +(10259,1,0), +(10260,1,0), +(10345,1,0), +(10604,1,0), +(10727,1,0), +(10747,1,0), +(11195,1,0), +(11402,1,0), +(11440,1,0), +(11513,1,0), +(11637,1,0), +(11757,1,0), +(11893,1,0), +(12134,1,0), +(12158,1,0), +(12159,1,0), +(12347,1,0), +(12512,1,0), +(12564,1,0), +(12613,1,0), +(12623,1,0), +(12699,1,0), +(12709,1,0), +(12774,1,0), +(12938,1,0), +(13461,1,0), +(13727,1,0), +(13821,1,0), +(13951,1,0), +(13982,1,0), +(14250,1,0), +(14292,1,0), +(14806,1,0), +(14813,1,0), +(14928,1,0), +(15252,1,0), +(15281,1,0), +(15591,1,0), +(15658,1,0), +(15746,1,0), +(15958,1,0), +(16007,1,0), +(16032,1,0), +(16037,1,0), +(16053,1,0), +(16068,1,0), +(16069,1,0), +(16070,1,0), +(16074,1,0), +(16378,1,0), +(16381,1,0), +(16404,1,0), +(16556,1,0), +(16558,1,0), +(16637,1,0), +(16786,1,0), +(16807,1,0), +(17048,1,0), +(17166,1,0), +(17190,1,0), +(17202,1,0), +(17272,1,0), +(17278,1,0), +(17279,1,0), +(17471,1,0), +(17536,1,0), +(17616,1,0), +(17618,1,0), +(17652,1,0), +(17671,1,0), +(17675,1,0), +(17676,1,0), +(17677,1,0), +(17678,1,0), +(17698,1,0), +(17748,1,0), +(18110,1,0), +(18655,1,0), +(18666,1,0), +(18811,1,0), +(18969,1,0), +(19032,1,0), +(19096,1,0), +(19571,1,0), +(19593,1,0), +(19721,1,0), +(19749,1,0), +(19770,1,0), +(19773,1,0), +(19952,1,0), +(20358,1,0), +(20465,1,0), +(20619,1,0), +(21052,1,0), +(21075,1,0), +(21076,1,0), +(21391,1,0), +(21556,1,0), +(21566,1,0), +(21885,1,0), +(21950,1,0), +(22096,1,0), +(22203,1,0), +(22205,1,0), +(22393,1,0), +(22458,1,0), +(22860,1,0), +(22906,1,0), +(22966,1,0), +(23014,1,0), +(23016,1,0), +(23018,1,0), +(23019,1,0), +(23168,1,0), +(23328,1,0), +(23360,1,0), +(23389,1,0), +(23394,1,0), +(23415,1,0), +(23642,1,0), +(23951,1,0), +(23974,1,0), +(24062,1,0), +(24083,1,0), +(24172,1,0), +(24207,1,0), +(24217,1,0), +(24311,1,0), +(24322,1,0), +(24323,1,0), +(24391,1,0), +(24734,1,0), +(24744,1,0), +(24756,1,0), +(24758,1,0), +(24760,1,0), +(24763,1,0), +(24765,1,0), +(24768,1,0), +(24770,1,0), +(24772,1,0), +(24784,1,0), +(24786,1,0), +(24788,1,0), +(24789,1,0), +(24790,1,0), +(24804,1,0), +(24933,1,0), +(25030,1,0), +(25031,1,0), +(25032,1,0), +(25099,1,0), +(25145,1,0), +(25149,1,0), +(25150,1,0), +(25158,1,0), +(25201,1,0), +(25715,1,0), +(25727,1,0), +(25745,1,0), +(25822,1,0), +(25823,1,0), +(25896,1,0), +(26235,1,0), +(26344,1,0), +(26345,1,0), +(26346,1,0), +(26347,1,0), +(26348,1,0), +(26349,1,0), +(26351,1,0), +(26352,1,0), +(26353,1,0), +(26354,1,0), +(26355,1,0), +(26356,1,0), +(26462,1,0), +(26522,1,1), +(26608,1,0), +(26687,1,1), +(26879,1,0), +(27583,1,0), +(27651,1,0), +(27663,1,0), +(27745,1,0), +(27885,1,0), +(27886,1,0), +(27892,1,0), +(27893,1,0), +(27894,1,0), +(27928,1,0), +(27929,1,0), +(27935,1,0), +(27936,1,0), +(28018,1,0), +(28032,1,0), +(28056,1,0), +(28078,1,0), +(28087,1,0), +(28096,1,0), +(28111,1,0), +(28159,1,0), +(28278,1,0), +(28281,1,0), +(28309,1,0), +(28326,1,0), +(28338,1,0), +(28339,1,0), +(28365,1,0), +(28366,1,0), +(28367,1,0), +(28374,1,0), +(28392,1,0), +(28404,1,0), +(28441,1,0), +(28605,1,0), +(28697,1,0), +(28731,1,0), +(28732,1,0), +(28861,1,0), +(29070,1,0), +(29072,1,0), +(29120,1,0), +(29121,1,0), +(29122,1,0), +(29172,1,0), +(29173,1,0), +(29176,1,0), +(29328,1,1), +(29339,1,0), +(29340,1,0), +(29428,1,0), +(29437,1,0), +(29456,1,0), +(29457,1,0), +(29458,1,0), +(29459,1,0), +(29461,1,0), +(29531,1,0), +(29534,1,0), +(29612,1,0), +(29705,1,0), +(29726,1,0), +(29727,1,0), +(29769,1,0), +(29770,1,0), +(29846,1,1), +(29962,1,0), +(29966,1,0), +(29967,1,0), +(29969,1,0), +(29970,1,0), +(29972,1,0), +(29989,1,0), +(30012,1,0), +(30065,1,0), +(30107,1,0), +(30166,1,0), +(30207,1,0), +(30221,1,0), +(30232,1,0), +(30273,1,0), +(30410,1,0), +(30417,1,0), +(30418,1,0), +(30425,1,0), +(30427,1,0), +(30460,1,0), +(30462,1,0), +(30469,1,0), +(30477,1,0), +(30541,1,0), +(30544,1,0), +(30571,1,1), +(30572,1,0), +(30625,1,0), +(30631,1,1), +(30656,1,0), +(30662,1,0), +(30676,1,0), +(30690,1,0), +(30735,1,0), +(30738,1,0), +(30745,1,0), +(30751,1,0), +(30762,1,0), +(30763,1,0), +(30764,1,0), +(30765,1,0), +(30766,1,0), +(30834,1,0), +(30835,1,0), +(30875,1,0), +(30876,1,0), +(30951,1,0), +(30952,1,0), +(30964,1,0), +(30968,1,0), +(30970,1,0), +(30974,1,0), +(30985,1,0), +(30988,1,0), +(31115,1,0), +(31225,1,0), +(31315,1,0), +(31324,1,0), +(31326,1,0), +(31329,1,0), +(31336,1,0), +(31346,1,0), +(31411,1,0), +(31412,1,0), +(31413,1,0), +(31414,1,0), +(31474,1,0), +(31515,1,0), +(31532,1,0), +(31537,1,0), +(31550,1,0), +(31611,1,0), +(31628,1,0), +(31630,1,0), +(31631,1,0), +(31702,1,0), +(31727,1,0), +(31736,1,0), +(31749,1,0), +(31781,1,0), +(31793,1,0), +(31799,1,0), +(31806,1,0), +(31889,1,0), +(31902,1,0), +(31936,1,0), +(31979,1,0), +(31993,1,0), +(32040,1,0), +(32042,1,0), +(32045,1,0), +(32051,1,0), +(32052,1,0), +(32087,1,0), +(32111,1,0), +(32127,1,0), +(32146,1,0), +(32163,1,0), +(32164,1,0), +(32227,1,0), +(32228,1,0), +(32251,1,0), +(32260,1,0), +(32286,1,0), +(32301,1,0), +(32303,1,0), +(32312,1,0), +(32373,1,0), +(32396,1,0), +(32560,1,0), +(32573,1,0), +(32589,1,0), +(32622,1,0), +(32623,1,0), +(32638,1,0), +(32668,1,0), +(32708,1,1), +(32760,1,0), +(32838,1,0), +(32890,1,0), +(32928,1,0), +(32929,1,0), +(32930,1,0), +(32953,1,0), +(32958,1,0), +(32974,1,0), +(32976,1,0), +(32979,1,0), +(33067,1,0), +(33270,1,1), +(33329,1,0), +(33332,1,0), +(33336,1,0), +(33337,1,0), +(33423,1,0), +(33424,1,0), +(33425,1,0), +(33531,1,0), +(33532,1,0), +(33618,1,0), +(33644,1,0), +(33655,1,0), +(33669,1,0), +(33710,1,0), +(33716,1,1), +(33742,1,0), +(33744,1,0), +(33796,1,0), +(33805,1,0), +(33806,1,0), +(33809,1,0), +(33822,1,0), +(33831,1,0), +(33838,1,0), +(33861,1,0), +(33862,1,0), +(33918,1,0), +(33924,1,0), +(33937,1,0), +(33981,1,0), +(34011,1,0), +(34013,1,0), +(34016,1,0), +(34019,1,0), +(34023,1,0), +(34024,1,0), +(34062,1,0), +(34063,1,0), +(34076,1,0), +(34119,1,0), +(34154,1,0), +(34156,1,0), +(34209,1,0), +(34211,1,0), +(34212,1,0), +(34221,1,0), +(34239,1,0), +(34254,1,0), +(34330,1,0), +(34332,1,0), +(34367,1,0), +(34378,1,0), +(34393,1,0), +(34397,1,0), +(34430,1,0), +(34516,1,0), +(34526,1,0), +(34536,1,0), +(34581,1,0), +(34583,1,0), +(34613,1,0), +(34627,1,0), +(34646,1,0), +(34662,1,0), +(34742,1,0), +(34806,1,0), +(34874,1,0), +(34893,1,0), +(34946,1,0), +(35016,1,0), +(35040,1,0), +(35063,1,0), +(35097,1,0), +(35113,1,0), +(35137,1,0), +(35140,1,0), +(35141,1,0), +(35155,1,0), +(35160,1,0), +(35162,1,0), +(35170,1,0), +(35176,1,0), +(35190,1,0), +(35245,1,0), +(35262,1,0), +(35282,1,0), +(35301,1,0), +(35372,1,0), +(35413,1,0), +(35427,1,0), +(35515,1,0), +(35516,1,0), +(35598,1,0), +(35600,1,0), +(35673,1,0), +(35682,1,0), +(35724,1,0), +(35746,1,0), +(35756,1,0), +(35770,1,0), +(35771,1,0), +(35772,1,0), +(35782,1,0), +(35930,1,0), +(35941,1,1), +(35956,1,1), +(35960,1,0), +(35961,1,0), +(35962,1,0), +(36000,1,0), +(36035,1,0), +(36089,1,0), +(36090,1,0), +(36103,1,0), +(36167,1,0), +(36174,1,0), +(36196,1,0), +(36197,1,0), +(36198,1,0), +(36201,1,0), +(36220,1,0), +(36239,1,0), +(36241,1,0), +(36243,1,0), +(36290,1,0), +(36291,1,0), +(36293,1,0), +(36327,1,0), +(36330,1,0), +(36378,1,0), +(36384,1,0), +(36431,1,0), +(36452,1,0), +(36455,1,1), +(36456,1,0), +(36514,1,0), +(36544,1,0), +(36639,1,0), +(36651,1,0), +(36652,1,0), +(36692,1,0), +(36709,1,0), +(36717,1,1), +(36779,1,0), +(36795,1,0), +(36802,1,0), +(36803,1,0), +(36804,1,0), +(36823,1,0), +(36852,1,0), +(36854,1,0), +(36856,1,0), +(36857,1,0), +(36858,1,0), +(36859,1,0), +(36871,1,0), +(36878,1,0), +(36884,1,0), +(36896,1,0), +(36951,1,0), +(36953,1,0), +(36969,1,0), +(36995,1,0), +(37013,1,0), +(37017,1,0), +(37032,1,0), +(37033,1,0), +(37034,1,0), +(37035,1,0), +(37051,1,0), +(37052,1,0), +(37053,1,0), +(37055,1,0), +(37056,1,0), +(37071,1,0), +(37072,1,0), +(37103,1,0), +(37142,1,0), +(37143,1,0), +(37144,1,0), +(37146,1,0), +(37147,1,0), +(37148,1,0), +(37149,1,0), +(37150,1,0), +(37151,1,0), +(37152,1,0), +(37153,1,0), +(37199,1,0), +(37220,1,0), +(37226,1,0), +(37229,1,0), +(37235,1,0), +(37281,1,0), +(37285,1,0), +(37337,1,0), +(37339,1,0), +(37345,1,0), +(37348,1,0), +(37388,1,0), +(37406,1,0), +(37408,1,1), +(37413,1,0), +(37422,1,0), +(37427,1,0), +(37428,1,0), +(37448,1,1), +(37449,1,1), +(37453,1,0), +(37454,1,0), +(37459,1,0), +(37461,1,0), +(37465,1,0), +(37469,1,0), +(37471,1,0), +(37472,1,0), +(37474,1,0), +(37476,1,0), +(37498,1,0), +(37502,1,0), +(37573,1,0), +(37626,1,0), +(37645,1,0), +(37689,1,0), +(37697,1,0), +(37712,1,0), +(37720,1,0), +(37748,1,0), +(37755,1,0), +(37775,1,0), +(37784,1,0), +(37824,1,0), +(37842,1,0), +(37843,1,0), +(37848,1,0), +(37849,1,1), +(37853,1,0), +(37868,1,0), +(37893,1,0), +(37895,1,0), +(37918,1,0), +(37934,1,0), +(37936,1,0), +(37964,1,0), +(37984,1,0), +(38003,1,0), +(38014,1,0), +(38015,1,0), +(38017,1,0), +(38020,1,0), +(38053,1,0), +(38054,1,0), +(38072,1,0), +(38073,1,0), +(38112,1,0), +(38121,1,0), +(38123,1,0), +(38126,1,0), +(38128,1,0), +(38130,1,0), +(38202,1,0), +(38250,1,0), +(38269,1,0), +(38360,1,0), +(38444,1,0), +(38451,1,0), +(38452,1,0), +(38455,1,0), +(38469,1,0), +(38482,1,0), +(38508,1,0), +(38530,1,0), +(38629,1,0), +(38632,1,0), +(38691,1,0), +(38711,1,0), +(38722,1,0), +(38736,1,0), +(38738,1,0), +(38762,1,0), +(38802,1,0), +(38829,1,1), +(38966,1,0), +(38968,1,0), +(39010,1,0), +(39011,1,0), +(39043,1,0), +(39073,1,0), +(39094,1,0), +(39124,1,0), +(39126,1,0), +(39140,1,0), +(39141,1,0), +(39184,1,0), +(39185,1,0), +(39189,1,0), +(39190,1,0), +(39206,1,0), +(39211,1,0), +(39216,1,0), +(39219,1,0), +(39221,1,0), +(39248,1,0), +(39334,1,0), +(39335,1,0), +(39338,1,0), +(39341,1,0), +(39342,1,0), +(39344,1,0), +(39350,1,0), +(39352,1,0), +(39353,1,0), +(39354,1,0), +(39355,1,0), +(39356,1,0), +(39357,1,0), +(39358,1,0), +(39359,1,0), +(39360,1,0), +(39361,1,0), +(39362,1,0), +(39395,1,0), +(39495,1,0), +(39497,1,1), +(39552,1,0), +(39559,1,0), +(39583,1,0), +(39601,1,0), +(39635,1,0), +(39678,1,0), +(39687,1,0), +(39690,1,0), +(39691,1,0), +(39692,1,0), +(39696,1,0), +(39758,1,0), +(39834,1,1), +(39849,1,0), +(39851,1,1), +(39852,1,1), +(39853,1,1), +(39854,1,1), +(39873,1,0), +(39899,1,0), +(39914,1,0), +(39915,1,0), +(39919,1,0), +(39921,1,0), +(39923,1,1), +(39930,1,0), +(39938,1,0), +(39939,1,0), +(39940,1,0), +(39974,1,0), +(39977,1,0), +(39978,1,0), +(39985,1,0), +(39989,1,0), +(39993,1,0), +(39999,1,0), +(40085,1,0), +(40094,1,0), +(40106,1,0), +(40110,1,0), +(40112,1,1), +(40136,1,0), +(40147,1,0), +(40153,1,0), +(40156,1,0), +(40160,1,0), +(40187,1,0), +(40189,1,0), +(40190,1,0), +(40224,1,0), +(40281,1,0), +(40287,1,0), +(40288,1,0), +(40289,1,0), +(40309,1,0), +(40350,1,0), +(40359,1,0), +(40382,1,0), +(40383,1,0), +(40397,1,0), +(40437,1,0), +(40439,1,0), +(40454,1,0), +(40490,1,0), +(40494,1,0), +(40498,1,0), +(40499,1,0), +(40512,1,0), +(40520,1,0), +(40521,1,0), +(40523,1,0), +(40532,1,0), +(40547,1,0), +(40607,1,0), +(40638,1,0), +(40693,1,0), +(40704,1,0), +(40707,1,0), +(40708,1,0), +(40709,1,0), +(40710,1,0), +(40711,1,0), +(40712,1,0), +(40713,1,0), +(40715,1,0), +(40730,1,1), +(40738,1,0), +(40750,1,0), +(40761,1,0), +(40788,1,0), +(40821,1,0), +(40824,1,0), +(40825,1,0), +(40828,1,0), +(40830,1,0), +(40848,1,1), +(40874,1,0), +(40887,1,0), +(40978,1,0), +(40985,1,1), +(40989,1,0), +(40993,1,1), +(41007,1,1), +(41015,1,1), +(41022,1,1), +(41073,1,0), +(41077,1,0), +(41122,1,0), +(41124,1,0), +(41125,1,0), +(41128,1,0), +(41129,1,0), +(41154,1,0), +(41257,1,0), +(41268,1,0), +(41269,1,0), +(41271,1,0), +(41285,1,1), +(41295,1,0), +(41333,1,0), +(41342,1,0), +(41343,1,0), +(41344,1,0), +(41362,1,0), +(41455,1,0), +(41457,1,0), +(41477,1,0), +(41499,1,0), +(41522,1,0), +(41525,1,0), +(41537,1,0), +(41557,1,0), +(41560,1,0), +(41575,1,0), +(41602,1,0), +(41614,1,0), +(41624,1,1), +(41975,1,0), +(41976,1,0), +(41993,1,0), +(42008,1,0), +(42014,1,0), +(42138,1,1), +(42143,1,0), +(42151,1,0), +(42166,1,0), +(42167,1,0), +(42168,1,0), +(42178,1,0), +(42219,1,0), +(42222,1,0), +(42247,1,0), +(42269,1,0), +(42271,1,0), +(42272,1,0), +(42289,1,0), +(42317,1,0), +(42318,1,0), +(42321,1,0), +(42339,1,0), +(42341,1,0), +(42352,1,0), +(42356,1,0), +(42391,1,0), +(42393,1,0), +(42405,1,0), +(42410,1,0), +(42415,1,0), +(42428,1,0), +(42442,1,0), +(42447,1,0), +(42454,1,0), +(42471,1,0), +(42473,1,0), +(42482,1,0), +(42484,1,0), +(42515,1,0), +(42517,1,0), +(42530,1,0), +(42534,1,0), +(42536,1,0), +(42542,1,0), +(42550,1,0), +(42564,1,0), +(42567,1,0), +(42570,1,0), +(42577,1,0), +(42585,1,0), +(42604,1,0), +(42605,1,0), +(42616,1,0), +(42631,1,0), +(42638,1,1), +(42647,1,0), +(42654,1,0), +(42655,1,0), +(42659,1,0), +(42661,1,0), +(42664,1,0), +(42674,1,1), +(42685,1,0), +(42695,1,0), +(42697,1,0), +(42703,1,0), +(42707,1,0), +(42713,1,0), +(42720,1,0), +(42734,1,0), +(42757,1,1), +(42768,1,0), +(42793,1,0), +(42797,1,0), +(42808,1,0), +(42809,1,0), +(42813,1,0), +(42815,1,0), +(42816,1,0), +(42818,1,0), +(42821,1,0), +(42839,1,0), +(42857,1,0), +(42881,1,0), +(42882,1,0), +(42883,1,0), +(42884,1,0), +(42888,1,0), +(42905,1,0), +(42968,1,0), +(42982,1,0), +(43033,1,0), +(43035,1,0), +(43057,1,0), +(43066,1,0), +(43068,1,0), +(43069,1,0), +(43072,1,0), +(43076,1,0), +(43078,1,0), +(43079,1,0), +(43092,1,0), +(43101,1,0), +(43106,1,0), +(43109,1,0), +(43144,1,0), +(43171,1,0), +(43209,1,0), +(43210,1,0), +(43234,1,0), +(43239,1,0), +(43244,1,0), +(43255,1,0), +(43291,1,0), +(43306,1,0), +(43307,1,0), +(43333,1,0), +(43371,1,0), +(43385,1,0), +(43386,1,0), +(43403,1,0), +(43404,1,0), +(43407,1,0), +(43450,1,0), +(43458,1,0), +(43468,1,0), +(43486,1,0), +(43487,1,0), +(43515,1,0), +(43520,1,0), +(43525,1,0), +(43546,1,0), +(43559,1,0), +(43563,1,0), +(43568,1,0), +(43615,1,0), +(43647,1,0), +(43662,1,0), +(43685,1,0), +(43691,1,0), +(43711,1,0), +(43734,1,0), +(43754,1,0), +(43770,1,0), +(43791,1,0), +(43805,1,0), +(43863,1,0), +(43865,1,0), +(43867,1,0), +(43871,1,0), +(43872,1,0), +(43878,1,0), +(43882,1,0), +(43892,1,0), +(43942,1,0), +(43943,1,0), +(43949,1,0), +(43962,1,0), +(43990,1,0), +(43994,1,0), +(44014,1,0), +(44022,1,0), +(44023,1,0), +(44024,1,0), +(44026,1,0), +(44027,1,0), +(44028,1,0), +(44037,1,0), +(44145,1,0), +(44161,1,0), +(44193,1,0), +(44214,1,0), +(44224,1,1), +(44229,1,0), +(44232,1,1), +(44250,1,0), +(44255,1,0), +(44260,1,0), +(44266,1,0), +(44270,1,0), +(44283,1,0), +(44284,1,0), +(44309,1,0), +(44313,1,0), +(44329,1,0), +(44330,1,0), +(44355,1,0), +(44362,1,0), +(44365,1,0), +(44367,1,0), +(44374,1,0), +(44392,1,0), +(44411,1,0), +(44420,1,0), +(44422,1,0), +(44458,1,0), +(44550,1,0), +(44562,1,0), +(44574,1,0), +(44609,1,0), +(44610,1,0), +(44653,1,0), +(44681,1,0), +(44682,1,1), +(44749,1,0), +(44804,1,0), +(44807,1,0), +(44826,1,0), +(44837,1,0), +(44838,1,0), +(44839,1,0), +(44840,1,0), +(44841,1,0), +(44842,1,0), +(44845,1,0), +(44846,1,0), +(44849,1,1), +(44864,1,0), +(44865,1,0), +(44872,1,0), +(44877,1,0), +(44883,1,0), +(44886,1,0), +(44938,1,0), +(44939,1,0), +(44941,1,0), +(44946,1,0), +(44948,1,0), +(44963,1,0), +(44965,1,0), +(44981,1,0), +(45005,1,0), +(45008,1,0), +(45012,1,0), +(45013,1,0), +(45076,1,0), +(45086,1,0), +(45103,1,0), +(45109,1,0), +(45114,1,0), +(45115,1,0), +(45119,1,0), +(45172,1,0), +(45188,1,0), +(45191,1,0), +(45219,1,0), +(45223,1,0), +(45224,1,0), +(45229,1,0), +(45233,1,0), +(45259,1,0), +(45260,1,1), +(45264,1,0), +(45267,1,0), +(45277,1,0), +(45279,1,0), +(45307,1,0), +(45323,1,0), +(45339,1,0), +(45340,1,0), +(45351,1,0), +(45368,1,0), +(45371,1,0), +(45388,1,0), +(45389,1,0), +(45405,1,0), +(45407,1,0), +(45414,1,0), +(45437,1,0), +(45446,1,0), +(45448,1,0), +(45449,1,0), +(45465,1,0), +(45474,1,0), +(45536,1,0), +(45581,1,0), +(45583,1,0), +(45586,1,0), +(45594,1,0), +(45595,1,0), +(45596,1,0), +(45597,1,0), +(45602,1,0), +(45605,1,0), +(45606,1,0), +(45607,1,0), +(45608,1,0), +(45609,1,0), +(45622,1,0), +(45623,1,0), +(45630,1,0), +(45634,1,0), +(45644,1,1), +(45651,1,0), +(45655,1,0), +(45656,1,0), +(45666,1,0), +(45667,1,0), +(45671,1,1), +(45680,1,1), +(45692,1,0), +(45700,1,0), +(45714,1,0), +(45732,1,0), +(45735,1,0), +(45761,1,0), +(45774,1,0), +(45780,1,0), +(45788,1,0), +(45805,1,0), +(45808,1,0), +(45834,1,0), +(45835,1,0), +(45841,1,0), +(45853,1,0), +(45859,1,0), +(45863,1,0), +(45864,1,0), +(45867,1,0), +(45872,1,0), +(45888,1,0), +(45907,1,0), +(45911,1,0), +(45912,1,0), +(45914,1,0), +(45918,1,1), +(45923,1,0), +(45929,1,0), +(45930,1,0), +(45941,1,0), +(45949,1,0), +(45961,1,0), +(45968,1,0), +(45969,1,0), +(45970,1,0), +(45976,1,0), +(45979,1,0), +(45990,1,0), +(45993,1,0), +(46013,1,0), +(46018,1,1), +(46022,1,0), +(46034,1,0), +(46054,1,0), +(46058,1,0), +(46063,1,0), +(46066,1,0), +(46068,1,0), +(46085,1,0), +(46143,1,0), +(46171,1,0), +(46173,1,0), +(62377,1,0), +(46175,1,0), +(46176,1,0), +(46177,1,0), +(46178,1,0), +(46201,1,0), +(46208,1,0), +(46219,1,0), +(46222,1,0), +(46236,1,0), +(46237,1,0), +(46245,1,0), +(46246,1,0), +(46281,1,0), +(46307,1,1), +(46318,1,0), +(46319,1,0), +(46320,1,1), +(46330,1,0), +(46363,1,0), +(46372,1,1), +(46374,1,0), +(46376,1,0), +(46382,1,0), +(46385,1,0), +(46396,1,1), +(46398,1,0), +(46399,1,0), +(46400,1,0), +(46474,1,0), +(46475,1,0), +(46477,1,0), +(46482,1,0), +(46488,1,0), +(46521,1,0), +(46588,1,1), +(46592,1,0), +(46593,1,0), +(46603,1,0), +(46609,1,0), +(46610,1,0), +(46623,1,0), +(46631,1,0), +(46637,1,0), +(46650,1,0), +(46652,1,0), +(46656,1,0), +(46685,1,0), +(46692,1,0), +(46694,1,0), +(46704,1,0), +(46707,1,0), +(46732,1,1), +(46733,1,0), +(46735,1,0), +(46747,1,0), +(46793,1,0), +(46797,1,0), +(46809,1,0), +(46815,1,0), +(46818,1,0), +(46820,1,0), +(46843,1,0), +(46886,1,0), +(46895,1,0), +(46900,1,0), +(46902,1,0), +(46903,1,0), +(46904,1,0), +(46936,1,0), +(46937,1,0), +(46963,1,0), +(46964,1,0), +(46965,1,1), +(46974,1,0), +(47016,1,0), +(47026,1,0), +(47035,1,0), +(47060,1,0), +(47065,1,0), +(47104,1,0), +(47110,1,0), +(47137,1,0), +(47170,1,0), +(47176,1,0), +(47184,1,0), +(47214,1,0), +(47253,1,0), +(47254,1,0), +(47336,1,0), +(47344,1,0), +(47370,1,1), +(47374,1,0), +(47378,1,0), +(47421,1,0), +(47452,1,0), +(47460,1,0), +(47463,1,0), +(47469,1,0), +(47542,1,0), +(47547,1,0), +(47563,1,0), +(47574,1,0), +(47593,1,0), +(47594,1,0), +(47596,1,0), +(47597,1,0), +(47598,1,0), +(47599,1,0), +(47616,1,0), +(47617,1,0), +(47618,1,0), +(47619,1,0), +(47634,1,0), +(47669,1,0), +(47670,1,0), +(47681,1,0), +(47682,1,0), +(47683,1,0), +(47684,1,0), +(47685,1,0), +(47691,1,1), +(47711,1,0), +(47712,1,0), +(47713,1,0), +(47747,1,0), +(47771,1,0), +(47787,1,0), +(47799,1,0), +(47911,1,0), +(47913,1,0), +(47916,1,0), +(47933,1,0), +(47935,1,0), +(47939,1,0), +(47959,1,0), +(48009,1,0), +(48021,1,0), +(48028,1,1), +(48035,1,0), +(48115,1,0), +(48117,1,0), +(48183,1,0), +(48185,1,0), +(48188,1,0), +(48194,1,1), +(48199,1,0), +(48201,1,0), +(48202,1,0), +(48213,1,0), +(48218,1,0), +(48222,1,0), +(48223,1,0), +(48227,1,0), +(48246,1,1), +(48252,1,0), +(48293,1,0), +(48306,1,0), +(48315,1,0), +(48329,1,0), +(48344,1,0), +(48345,1,0), +(48362,1,0), +(48363,1,0), +(48375,1,0), +(48385,1,0), +(48398,1,0), +(48399,1,0), +(48425,1,0), +(48426,1,0), +(48455,1,0), +(48490,1,0), +(48497,1,0), +(48508,1,0), +(48530,1,0), +(48551,1,0), +(48597,1,0), +(48600,1,0), +(48605,1,0), +(48620,1,0), +(48623,1,0), +(48627,1,0), +(48641,1,0), +(48642,1,0), +(48646,1,0), +(48649,1,0), +(48685,1,0), +(48724,1,0), +(48726,1,0), +(48728,1,0), +(48730,1,0), +(48732,1,0), +(48748,1,0), +(48764,1,0), +(48771,1,0), +(48773,1,0), +(48790,1,0), +(48793,1,0), +(48799,1,0), +(48808,1,0), +(48811,1,0), +(48896,1,0), +(48901,1,0), +(48904,1,0), +(48929,1,0), +(48974,1,0), +(48975,1,0), +(49022,1,0), +(49030,1,0), +(49058,1,0), +(49062,1,0), +(49075,1,0), +(49080,1,0), +(49083,1,0), +(49118,1,0), +(49125,1,0), +(49128,1,0), +(49129,1,0), +(49131,1,0), +(49134,1,0), +(49135,1,0), +(49159,1,0), +(49166,1,0), +(49210,1,0), +(49211,1,0), +(49262,1,0), +(49291,1,0), +(49292,1,0), +(49313,1,0), +(49319,1,0), +(49325,1,0), +(49330,1,0), +(49332,1,0), +(49333,1,0), +(49334,1,0), +(49367,1,0), +(49370,1,0), +(49404,1,0), +(49405,1,0), +(49428,1,0), +(49434,1,0), +(49515,1,0), +(49517,1,0), +(49519,1,0), +(49524,1,0), +(49525,1,0), +(49552,1,0), +(49554,1,0), +(49555,1,0), +(49557,1,0), +(49590,1,0), +(49625,1,0), +(49634,1,0), +(49679,1,0), +(49682,1,0), +(49683,1,0), +(49684,1,0), +(49731,1,0), +(49751,1,0), +(49762,1,0), +(49825,1,0), +(49826,1,0), +(49829,1,0), +(49858,1,0), +(49862,1,0), +(49870,1,0), +(49899,1,0), +(49947,1,0), +(50036,1,0), +(50087,1,0), +(50133,1,0), +(50173,1,0), +(50174,1,0), +(50176,1,0), +(50177,1,0), +(50178,1,0), +(50179,1,0), +(50312,1,0), +(50315,1,1), +(50331,1,0), +(50350,1,0), +(50382,1,0), +(50383,1,0), +(50398,1,1), +(50430,1,0), +(50440,1,0), +(50492,1,0), +(50515,1,0), +(50524,1,0), +(50546,1,0), +(50547,1,0), +(50548,1,0), +(50554,1,0), +(50556,1,0), +(50562,1,0), +(50563,1,0), +(50568,1,0), +(50569,1,0), +(50592,1,0), +(50628,1,0), +(50669,1,0), +(50674,1,0), +(50682,1,1), +(50742,1,0), +(50775,1,0), +(50793,1,0), +(50794,1,0), +(50817,1,0), +(50835,1,0), +(50878,1,0), +(50883,1,1), +(50892,1,0), +(51001,1,0), +(51022,1,0), +(51023,1,0), +(51024,1,0), +(51025,1,0), +(51039,1,0), +(51049,1,0), +(51122,1,0), +(51136,1,0), +(51139,1,0), +(51152,1,0), +(51171,1,0), +(51172,1,0), +(51202,1,0), +(51213,1,0), +(51215,1,0), +(51234,1,0), +(51239,1,0), +(51247,1,0), +(51256,1,0), +(51276,1,0), +(51288,1,0), +(51318,1,0), +(51331,1,0), +(51332,1,0), +(51333,1,0), +(51343,1,0), +(51366,1,0), +(51368,1,0), +(51381,1,0), +(51384,1,0), +(51393,1,0), +(51396,1,0), +(51403,1,0), +(51420,1,0), +(51448,1,1), +(51516,1,0), +(51518,1,0), +(51577,1,0), +(51579,1,0), +(51590,1,0), +(51603,1,0), +(51606,1,0), +(51607,1,0), +(51616,1,0), +(51639,1,0), +(51641,1,0), +(51642,1,0), +(51643,1,0), +(51644,1,0), +(51645,1,0), +(51649,1,0), +(51650,1,0), +(51651,1,0), +(51652,1,0), +(51670,1,0), +(51694,1,0), +(51697,1,0), +(51727,1,0), +(51737,1,0), +(51739,1,0), +(51743,1,0), +(51754,1,0), +(51767,1,0), +(51769,1,0), +(51773,1,0), +(51774,1,0), +(51791,1,0), +(51794,1,0), +(51825,1,0), +(51840,1,0), +(51843,1,0), +(51858,1,0), +(51859,1,0), +(51861,1,0), +(51866,1,0), +(51870,1,0), +(51902,1,0), +(51904,1,0), +(51907,1,0), +(51910,1,0), +(51925,1,0), +(51927,1,0), +(51931,1,0), +(51932,1,0), +(51933,1,0), +(51942,1,0), +(51959,1,0), +(51964,1,0), +(51965,1,0), +(52011,1,0), +(52037,1,0), +(52059,1,0), +(52064,1,0), +(52089,1,0), +(52106,1,0), +(52122,1,0), +(52124,1,0), +(52140,1,0), +(52151,1,0), +(52164,1,0), +(52170,1,0), +(52173,1,0), +(52185,1,0), +(52227,1,0), +(52229,1,0), +(52238,1,0), +(52239,1,0), +(52242,1,0), +(52247,1,0), +(52254,1,0), +(52257,1,0), +(52259,1,0), +(52264,1,0), +(52294,1,0), +(52313,1,0), +(52322,1,0), +(52335,1,0), +(52336,1,0), +(52337,1,1), +(52340,1,0), +(52343,1,0), +(52349,1,0), +(52365,1,1), +(52369,1,0), +(52371,1,0), +(52381,1,0), +(52387,1,0), +(52388,1,0), +(52407,1,0), +(52412,1,0), +(52414,1,0), +(52427,1,0), +(52438,1,0), +(52446,1,0), +(52449,1,0), +(52452,1,0), +(52453,1,0), +(52454,1,0), +(52457,1,0), +(52458,1,0), +(52512,1,0), +(52514,1,0), +(52528,1,0), +(52576,1,0), +(52577,1,0), +(52585,1,0), +(52607,1,0), +(52632,1,0), +(52638,1,0), +(52654,1,0), +(52661,1,0), +(52676,1,0), +(52681,1,0), +(52686,1,0), +(52687,1,0), +(52688,1,0), +(52725,1,0), +(52726,1,0), +(52727,1,0), +(52728,1,0), +(52729,1,0), +(52730,1,0), +(52731,1,0), +(52732,1,0), +(52774,1,0), +(52791,1,0), +(52793,1,0), +(52805,1,0), +(52811,1,0), +(52816,1,0), +(52833,1,0), +(52834,1,0), +(52837,1,0), +(52838,1,0), +(52844,1,0), +(52850,1,0), +(52884,1,0), +(52908,1,0), +(52920,1,0), +(52930,1,0), +(52934,1,0), +(52935,1,0), +(52936,1,0), +(52937,1,0), +(52953,1,0), +(52955,1,0), +(52956,1,0), +(52981,1,0), +(52989,1,0), +(52990,1,0), +(53010,1,0), +(53020,1,0), +(53024,1,0), +(53029,1,0), +(53038,1,0), +(53083,1,0), +(53093,1,0), +(53096,1,0), +(53106,1,0), +(53110,1,0), +(53163,1,0), +(53170,1,0), +(53177,1,0), +(53185,1,0), +(53206,1,0), +(53210,1,0), +(53242,1,1), +(53272,1,0), +(53441,1,0), +(53464,1,0), +(53465,1,0), +(53466,1,0), +(53570,1,0), +(53609,1,0), +(53613,1,0), +(53626,1,0), +(53644,1,0), +(53680,1,0), +(53683,1,0), +(53684,1,0), +(53685,1,0), +(53701,1,0), +(53714,1,1), +(53717,1,0), +(53730,1,0), +(53745,1,0), +(53757,1,1), +(53778,1,0), +(53798,1,0), +(53826,1,0), +(53827,1,0), +(53828,1,0), +(53829,1,0), +(54040,1,0), +(54047,1,0), +(54089,1,0), +(54090,1,0), +(54097,1,0), +(54108,1,0), +(54112,1,0), +(54128,1,0), +(54142,1,0), +(54209,1,0), +(54236,1,0), +(54245,1,0), +(54250,1,0), +(54258,1,0), +(54264,1,0), +(54265,1,0), +(54266,1,0), +(54267,1,0), +(54269,1,0), +(54323,1,0), +(54325,1,0), +(54327,1,0), +(54328,1,0), +(54377,1,0), +(54423,1,0), +(54426,1,0), +(54430,1,0), +(54464,1,0), +(54510,1,0), +(54522,1,0), +(54539,1,0), +(54548,1,0), +(54643,1,0), +(54656,1,0), +(54664,1,0), +(54685,1,0), +(54699,1,1), +(54725,1,1), +(54728,1,0), +(54744,1,1), +(54746,1,1), +(54773,1,0), +(54796,1,0), +(54798,1,0), +(54806,1,0), +(54878,1,0), +(54899,1,0), +(54984,1,0), +(54985,1,0), +(54988,1,0), +(54991,1,0), +(55063,1,0), +(55089,1,0), +(55127,1,0), +(55134,1,0), +(55137,1,0), +(55138,1,0), +(55141,1,0), +(55145,1,0), +(55161,1,0), +(55223,1,0), +(55227,1,0), +(55229,1,0), +(55231,1,0), +(55244,1,0), +(55257,1,0), +(55287,1,0), +(55288,1,0), +(55290,1,0), +(55406,1,0), +(55418,1,0), +(55419,1,0), +(55423,1,1), +(55432,1,0), +(55465,1,0), +(55468,1,0), +(55510,1,0), +(55516,1,0), +(55519,1,0), +(55524,1,0), +(55526,1,0), +(55527,1,0), +(55571,1,0), +(55578,1,0), +(55616,1,1), +(55647,1,0), +(55660,1,0), +(55661,1,0), +(55662,1,0), +(55693,1,0), +(55720,1,0), +(55721,1,0), +(55722,1,0), +(55723,1,0), +(55724,1,0), +(55725,1,0), +(55726,1,0), +(55727,1,0), +(55785,1,0), +(55796,1,0), +(55801,1,0), +(55803,1,0), +(55805,1,0), +(55811,1,0), +(55844,1,0), +(55853,1,0), +(55868,1,0), +(55872,1,0), +(55875,1,0), +(55878,1,1), +(55881,1,1), +(55882,1,0), +(55885,1,1), +(55886,1,0), +(55887,1,1), +(55888,1,0), +(55954,1,0), +(56047,1,0), +(56066,1,0), +(56099,1,0), +(56103,1,0), +(56114,1,0), +(56117,1,0), +(56150,1,0), +(56152,1,0), +(56189,1,0), +(56227,1,0), +(56253,1,0), +(56263,1,0), +(56264,1,0), +(56265,1,0), +(56266,1,0), +(56275,1,0), +(56312,1,0), +(56387,1,0), +(56388,1,0), +(56393,1,0), +(56429,1,0), +(56458,1,0), +(56505,1,0), +(56523,1,0), +(56560,1,0), +(56563,1,0), +(56567,1,0), +(56575,1,0), +(56621,1,0), +(56622,1,0), +(56652,1,0), +(56661,1,0), +(56663,1,0), +(56665,1,0), +(56667,1,0), +(56669,1,0), +(56673,1,0), +(56677,1,0), +(56680,1,0), +(56683,1,0), +(56688,1,0), +(56691,1,0), +(56693,1,0), +(56695,1,0), +(56696,1,0), +(56711,1,0), +(56713,1,0), +(56722,1,0), +(56723,1,0), +(56724,1,0), +(56725,1,0), +(56738,1,0), +(56763,1,0), +(56764,1,0), +(56865,1,0), +(56905,1,0), +(56917,1,0), +(56941,1,1), +(57042,1,0), +(57068,1,0), +(57071,1,0), +(57072,1,0), +(57410,1,0), +(57417,1,0), +(57420,1,0), +(57422,1,0), +(57469,1,0), +(57471,1,0), +(57495,1,0), +(57523,1,0), +(57534,1,0), +(57632,1,0), +(57637,1,0), +(57638,1,0), +(57639,1,0), +(57642,1,0), +(57650,1,0), +(57659,1,0), +(57666,1,0), +(57667,1,0), +(57682,1,0), +(57732,1,0), +(57734,1,0), +(57735,1,0), +(57736,1,0), +(57737,1,0), +(57738,1,0), +(57797,1,0), +(57806,1,0), +(57809,1,0), +(57828,1,0), +(57852,1,0), +(57853,1,0), +(57885,1,0), +(57891,1,0), +(57912,1,0), +(57930,1,0), +(57962,1,0), +(57963,1,0), +(57980,1,0), +(57983,1,0), +(58036,1,0), +(58040,1,0), +(58064,1,0), +(58084,1,0), +(58103,1,0), +(58108,1,0), +(58109,1,0), +(58112,1,0), +(58114,1,0), +(58121,1,0), +(58123,1,0), +(58124,1,0), +(58131,1,0), +(58152,1,0), +(58178,1,0), +(58195,1,1), +(58196,1,1), +(58197,1,1), +(58198,1,1), +(58225,1,0), +(58350,1,0), +(58416,1,0), +(58493,1,1), +(58515,1,0), +(58533,1,0), +(58542,1,0), +(58552,1,0), +(58593,1,0), +(58641,1,0), +(58658,1,0), +(58672,1,0), +(58685,1,0), +(58793,1,0), +(58836,1,0), +(58838,1,0), +(58846,1,1), +(58858,1,0), +(58873,1,0), +(58916,1,0), +(58917,1,0), +(58945,1,0), +(58949,1,0), +(59078,1,0), +(59091,1,0), +(59098,1,0), +(59115,1,0), +(59125,1,0), +(59189,1,0), +(59190,1,0), +(59284,1,0), +(59335,1,0), +(59363,1,0), +(59375,1,0), +(59383,1,0), +(59386,1,0), +(59396,1,0), +(59449,1,0), +(59456,1,0), +(59461,1,1), +(59528,1,0), +(59534,1,0), +(59552,1,0), +(59554,1,0), +(59556,1,1), +(59579,1,0), +(59595,1,0), +(59643,1,0), +(59655,1,0), +(59668,1,0), +(59677,1,0), +(59678,1,0), +(59704,1,0), +(59729,1,0), +(59730,1,0), +(59764,1,0), +(59780,1,0), +(59781,1,0), +(59807,1,0), +(59847,1,0), +(59867,1,0), +(59871,1,0), +(59897,1,0), +(59925,1,0), +(59930,1,0), +(59951,1,0), +(59952,1,0), +(59977,1,0), +(60038,1,0), +(60045,1,0), +(60046,1,0), +(60088,1,0), +(60104,1,0), +(60178,1,1), +(60207,1,0), +(60208,1,0), +(60224,1,0), +(60243,1,0), +(60256,1,0), +(60285,1,0), +(60288,1,0), +(60291,1,1), +(60292,1,1), +(60293,1,1), +(60294,1,1), +(60295,1,1), +(60296,1,1), +(60297,1,1), +(60298,1,0), +(60310,1,0), +(60315,1,0), +(60316,1,0), +(60342,1,0), +(60422,1,0), +(60456,1,0), +(60476,1,1), +(60496,1,0), +(60499,1,1), +(60507,1,1), +(60508,1,1), +(60511,1,0), +(60516,1,0), +(60522,1,1), +(60528,1,0), +(60535,1,0), +(60536,1,0), +(60561,1,0), +(60612,1,0), +(60614,1,0), +(60713,1,0), +(60810,1,0), +(60829,1,0), +(60831,1,0), +(60834,1,0), +(60836,1,0), +(60863,1,0), +(60909,1,0), +(60912,1,1), +(60967,1,0), +(61007,1,0), +(61026,1,0), +(61028,1,0), +(61071,1,0), +(61072,1,0), +(61073,1,0), +(61074,1,0), +(61075,1,0), +(61114,1,0), +(61121,1,0), +(61151,1,0), +(61152,1,0), +(61180,1,0), +(61210,1,0), +(61219,1,0), +(61245,1,0), +(61254,1,0), +(61353,1,0), +(61355,1,0), +(61397,1,0), +(61408,1,0), +(61416,1,0), +(61487,1,0), +(61488,1,0), +(61492,1,0), +(61524,1,0), +(61537,1,0), +(61588,1,0), +(61602,1,0), +(61647,1,0), +(61652,1,0), +(61665,1,0), +(61710,1,0), +(61738,1,0), +(61764,1,0), +(61765,1,0), +(61766,1,0), +(61771,1,0), +(61816,1,1), +(61863,1,1), +(61901,1,0), +(61934,1,0), +(61942,1,0), +(61964,1,0), +(61975,1,0), +(62002,1,0), +(62016,1,0), +(62034,1,0), +(62037,1,1), +(62072,1,0), +(62082,1,0), +(62083,1,0), +(62084,1,0), +(62091,1,0), +(62102,1,0), +(62195,1,0), +(62223,1,0), +(62266,1,0), +(62272,1,0), +(62278,1,0), +(62284,1,0), +(62304,1,0), +(62323,1,0), +(62343,1,0), +(47129,2,0), +(34395,2,0), +(34387,2,0), +(32440,2,0), +(32439,2,0), +(32205,2,0), +(31538,2,0), +(30740,2,0), +(29831,2,0), +(28806,2,0), +(28353,2,0), +(27517,2,0), +(27203,2,0), +(27202,2,0), +(27201,2,0), +(27191,2,0), +(27190,2,0), +(27184,2,0), +(26560,2,0), +(26063,2,0), +(25005,2,0), +(24934,2,0), +(24871,2,0), +(24721,2,0), +(24390,2,0), +(23208,2,0), +(21127,2,0), +(18431,2,0), +(17731,2,0), +(17016,2,0), +(16613,2,0), +(16447,2,0), +(13489,2,0), +(12139,2,0), +(11792,2,0), +(9224,2,0), +(9223,2,0), +(9222,2,0), +(9221,2,0), +(8674,2,0), +(7729,2,0), +(7728,2,0), +(3921,2,0), +(35683,2,0), +(36066,2,0), +(36546,2,0), +(36851,2,0), +(37754,2,0), +(38439,2,0), +(38782,2,0), +(39050,2,0), +(40055,2,0), +(40165,2,0), +(40166,2,0), +(40167,2,0), +(40328,2,0), +(40447,2,0), +(40468,2,0), +(40632,2,0), +(40640,2,0), +(40642,2,0), +(40644,2,0), +(40675,2,0), +(40774,2,0), +(40785,2,0), +(40964,2,0), +(40965,2,0), +(40968,2,0), +(40970,2,0), +(41004,2,0), +(41145,2,0), +(41146,2,0), +(42020,2,0), +(42022,2,0), +(42323,2,0), +(42788,2,0), +(43418,2,0), +(43552,2,0), +(43723,2,0), +(43753,2,0), +(43768,2,0), +(43950,2,0), +(44307,2,0), +(44498,2,0), +(44499,2,0), +(44611,2,0), +(44686,2,0), +(44874,2,0), +(44885,2,0), +(45149,2,0), +(45222,2,0), +(45226,2,0), +(45795,2,0), +(45877,2,0), +(45971,2,0), +(46072,2,0), +(46350,2,0), +(46360,2,1), +(46584,2,0), +(76006,2,0), +(74179,2,0), +(72869,2,0), +(72868,2,0), +(72608,2,0), +(72456,2,0), +(72405,2,0), +(72340,2,1), +(71284,2,1), +(70598,2,1), +(70446,2,1), +(70346,2,0), +(70227,2,0), +(70199,2,0), +(70175,2,0), +(70173,2,0), +(69402,2,0), +(69400,2,0), +(69294,2,0), +(69157,2,0), +(67815,2,0), +(67814,2,0), +(67813,2,0), +(67812,2,0), +(67798,2,0), +(67459,2,0), +(67458,2,0), +(67448,2,0), +(67439,2,0), +(67436,2,0), +(66676,2,0), +(66672,2,0), +(66655,2,0), +(66531,2,0), +(66289,2,0), +(65209,2,0), +(64871,2,0), +(64570,2,0), +(64436,2,0), +(63618,2,0), +(63381,2,0), +(62776,2,0), +(62714,2,0), +(62635,2,0), +(62397,2,0), +(62363,2,0), +(62357,2,0), +(62355,2,0), +(62307,2,0), +(62086,2,0), +(61999,2,1), +(60289,2,0), +(60101,2,0), +(59790,2,0), +(59732,2,0), +(59576,2,0), +(58596,2,0), +(58231,2,0), +(57945,2,0), +(57619,2,0), +(57610,2,0), +(57607,2,0), +(57583,2,0), +(57575,2,0), +(57544,2,0), +(57517,2,0), +(57415,2,0), +(56790,2,0), +(56570,2,0), +(56385,2,0), +(56350,2,0), +(55934,2,0), +(55820,2,0), +(55367,2,0), +(55197,2,0), +(54712,2,0), +(54666,2,0), +(54530,2,0), +(52510,2,0), +(52408,2,0), +(52339,2,0), +(52277,2,0), +(52274,2,0), +(52115,2,0), +(51383,2,0), +(51328,2,0), +(51327,2,0), +(51326,2,0), +(51325,2,0), +(51241,2,0), +(50999,2,0), +(50319,2,0), +(50026,2,0), +(50003,2,0), +(49867,2,0), +(49860,2,0), +(49765,2,0), +(49728,2,0), +(49693,2,0), +(49689,2,0), +(49158,2,0), +(49123,2,0), +(49109,2,0), +(48794,2,0), +(48738,2,0), +(48347,2,0), +(47978,2,0), +(35246,2,0), +(42576,3,0), +(42492,3,0), +(42475,3,0), +(42433,3,0), +(42350,3,0), +(42348,3,0), +(42242,3,1), +(42228,3,0), +(42220,3,0), +(42114,3,0), +(41221,3,0), +(40961,3,0), +(40960,3,0), +(40959,3,0), +(40957,3,0), +(40885,3,0), +(40603,3,0), +(40495,3,0), +(40401,3,0), +(40380,3,0), +(40341,3,0), +(40307,3,0), +(40286,3,0), +(40285,3,0), +(40284,3,0), +(40283,3,0), +(40268,3,0), +(40247,3,0), +(40246,3,0), +(40245,3,0), +(40244,3,0), +(40240,3,0), +(40222,3,0), +(40179,3,0), +(40178,3,0), +(40177,3,0), +(40176,3,0), +(40105,3,0), +(40076,3,0), +(39932,3,0), +(39887,3,0), +(39844,3,0), +(39832,3,1), +(39831,3,0), +(39558,3,0), +(39401,3,0), +(39399,3,0), +(39398,3,0), +(39393,3,0), +(39384,3,0), +(39364,3,0), +(38866,3,0), +(38680,3,0), +(38173,3,0), +(38046,3,0), +(38044,3,0), +(37970,3,0), +(37954,3,0), +(37942,3,0), +(37919,3,0), +(37913,3,0), +(37793,3,1), +(37789,3,0), +(37750,3,1), +(37504,3,0), +(37489,3,0), +(37473,3,1), +(37366,3,0), +(37134,3,0), +(36821,3,0), +(36811,3,0), +(36450,3,0), +(36449,3,1), +(36325,3,0), +(35958,3,0), +(35776,3,0), +(35734,3,0), +(35599,3,0), +(35596,3,0), +(34303,3,0), +(34200,3,0), +(34186,3,0), +(42578,3,0), +(33814,3,0), +(33783,3,0), +(33670,3,0), +(33664,3,0), +(33365,3,0), +(33240,3,0), +(33111,3,0), +(32785,3,0), +(32314,3,0), +(32307,3,0), +(32241,3,0), +(32148,3,0), +(32067,3,0), +(31927,3,0), +(31543,3,0), +(31364,3,0), +(31363,3,0), +(31333,3,0), +(30758,3,0), +(30741,3,0), +(30284,3,0), +(29945,3,0), +(29866,3,0), +(29820,3,1), +(29460,3,0), +(28373,3,0), +(28250,3,0), +(28054,3,0), +(26521,3,0), +(26519,3,0), +(26518,3,0), +(26517,3,0), +(26516,3,0), +(26490,3,0), +(26488,3,0), +(26393,3,1), +(26373,3,0), +(26338,3,0), +(26337,3,0), +(26336,3,0), +(26335,3,0), +(26334,3,0), +(26333,3,0), +(26329,3,0), +(26328,3,0), +(26327,3,0), +(26326,3,0), +(26325,3,0), +(26304,3,0), +(26295,3,0), +(26294,3,0), +(26293,3,0), +(26292,3,0), +(26291,3,0), +(26286,3,0), +(25687,3,0), +(25183,3,0), +(25181,3,0), +(25180,3,0), +(25178,3,0), +(25177,3,0), +(24973,3,0), +(24731,3,0), +(23024,3,0), +(21086,3,0), +(21014,3,0), +(20038,3,0), +(20037,3,0), +(19873,3,0), +(17179,3,0), +(16629,3,0), +(16452,3,0), +(16337,3,0), +(15998,3,0), +(13488,3,0), +(12151,3,0), +(10860,3,0), +(10836,3,0), +(10835,3,0), +(10834,3,0), +(10805,3,0), +(9257,3,0), +(9232,3,0), +(42868,3,0), +(43233,3,0), +(43539,3,0), +(43664,3,0), +(43898,3,0), +(43954,3,0), +(43963,3,0), +(43986,3,0), +(44013,3,0), +(44132,3,0), +(44213,3,0), +(44249,3,0), +(44320,3,0), +(44321,3,0), +(44375,3,0), +(44465,3,0), +(44554,3,0), +(44565,3,0), +(44603,3,0), +(44678,3,0), +(44844,3,0), +(44884,3,0), +(45030,3,0), +(45050,3,1), +(45201,3,0), +(45203,3,0), +(45404,3,0), +(45502,3,0), +(45585,3,0), +(45633,3,0), +(45635,3,0), +(45653,3,0), +(45839,3,0), +(45885,3,1), +(46417,3,0), +(46574,3,0), +(46638,3,1), +(46852,3,0), +(46896,3,0), +(47030,3,1), +(47328,3,0), +(47510,3,0), +(47628,3,0), +(47745,3,0), +(47775,3,1), +(47800,3,0), +(48198,3,0), +(48212,3,0), +(48331,3,0), +(48431,3,0), +(48882,3,0), +(48972,3,0), +(49197,3,0), +(49300,3,0), +(49308,3,0), +(49453,3,0), +(49735,3,0), +(50313,3,1), +(50348,3,0), +(50443,3,0), +(50501,3,0), +(50626,3,0), +(50639,3,0), +(50640,3,0), +(50716,3,0), +(50790,3,0), +(50791,3,0), +(50802,3,0), +(50803,3,0), +(50825,3,0), +(50826,3,0), +(51212,3,0), +(51246,3,0), +(51395,3,0), +(51511,3,0), +(51742,3,0), +(51748,3,0), +(51805,3,0), +(51846,3,0), +(52067,3,1), +(52271,3,0), +(52305,3,0), +(52479,3,0), +(52480,3,0), +(52497,3,0), +(52603,3,0), +(52683,3,0), +(52685,3,0), +(52812,3,0), +(53677,3,0), +(53679,3,0), +(53694,3,0), +(53705,3,0), +(53706,3,0), +(54272,3,0), +(54517,3,0), +(54914,3,0), +(54961,3,0), +(54990,3,0), +(55037,3,0), +(55083,3,0), +(55365,3,0), +(55479,3,0), +(55715,3,0), +(55800,3,0), +(55889,3,1), +(56095,3,0), +(56140,3,0), +(56386,3,0), +(56389,3,0), +(56578,3,0), +(56747,3,0), +(56765,3,0), +(57586,3,0), +(57800,3,0), +(57824,3,0), +(57835,3,0), +(58766,3,0), +(58825,3,0), +(59008,3,0), +(59462,3,0), +(59464,3,0), +(59564,3,0), +(59629,3,0), +(59694,3,0), +(60639,3,0), +(61126,3,0), +(61224,3,0), +(61699,3,0), +(62000,3,0), +(62056,3,0), +(62385,3,0), +(62387,3,0), +(62399,3,0), +(62565,3,0), +(62709,3,0), +(62973,3,0), +(62991,3,0), +(63019,3,0), +(63122,3,1), +(63292,3,0), +(63294,3,0), +(63295,3,0), +(63317,3,0), +(63414,3,0), +(63528,3,0), +(63766,3,0), +(63983,3,0), +(63985,3,0), +(64021,3,0), +(65044,3,0), +(65045,3,0), +(65101,3,0), +(65585,3,0), +(65586,3,0), +(65690,3,0), +(66129,3,0), +(66170,3,0), +(66598,3,0), +(67398,3,0), +(68378,3,0), +(68902,3,0), +(69007,3,0), +(69095,3,0), +(69096,3,0), +(69708,3,0), +(69783,3,0), +(69797,3,0), +(69799,3,0), +(69802,3,0), +(69985,3,0), +(70028,3,0), +(70037,3,0), +(70194,3,0), +(70521,3,0), +(70564,3,0), +(70590,3,0), +(70997,3,0), +(70998,3,0), +(70999,3,0), +(71278,3,1), +(71621,3,0), +(71704,3,0), +(72155,3,1), +(72162,3,1), +(72274,3,1), +(72297,3,1), +(72460,3,1), +(72548,3,1), +(72549,3,1), +(72550,3,1), +(72619,3,1), +(72620,3,1), +(72679,3,0), +(72771,3,0), +(72850,3,0), +(72851,3,0), +(72852,3,0), +(74318,3,0), +(74319,3,0), +(74320,3,0), +(74472,3,0), +(75509,3,0), +(75553,3,1), +(75766,3,1), +(34012,3,0), +(74271,4,0), +(74270,4,0), +(72096,4,1), +(72034,4,1), +(71615,4,0), +(70827,4,0), +(69425,4,0), +(69164,4,0), +(69162,4,0), +(68981,4,0), +(68788,4,1), +(67816,4,0), +(67796,4,0), +(65370,4,0), +(65333,4,0), +(64626,4,0), +(62826,4,0), +(62489,4,0), +(62466,4,0), +(62457,4,0), +(62345,4,0), +(62308,4,0), +(60206,4,0), +(58185,4,0), +(55896,4,0), +(55349,4,0), +(54109,4,0), +(54107,4,0), +(51678,4,0), +(50652,4,0), +(49556,4,0), +(48610,4,0), +(48277,4,0), +(48224,4,0), +(47674,4,0), +(47109,4,0), +(45922,4,0), +(44969,4,0), +(44737,4,0), +(44687,4,0), +(44626,4,0), +(44233,4,0), +(40647,4,0), +(40259,4,0), +(39246,4,0), +(36904,4,0), +(36460,4,0), +(36374,4,0), +(30532,4,0), +(28995,4,0), +(10451,4,0), +(9735,4,0), +(8900,4,0), +(8899,4,0), +(8898,4,0), +(8202,4,0), +(74272,4,0), +(69767,5,0), +(65590,5,0), +(62386,5,0), +(55588,5,0), +(54713,5,0), +(49464,5,0), +(49460,5,0), +(49346,5,0), +(47310,5,1), +(45676,5,0), +(44217,5,0), +(43977,5,0), +(41962,5,0), +(40789,5,0), +(40503,5,0), +(38729,5,0), +(38312,5,0), +(38106,5,0), +(38105,5,0), +(38104,5,0), +(38103,5,0), +(38102,5,0), +(38101,5,0), +(38100,5,0), +(38099,5,0), +(37206,5,0), +(37205,5,0), +(37204,5,0), +(36817,5,0), +(34630,5,0), +(21866,5,0), +(21794,5,0), +(19832,5,0), +(19250,5,0), +(8913,5,0), +(67308,6,0), +(67307,6,0), +(67306,6,0), +(67305,6,0), +(67304,6,0), +(67303,6,0), +(65876,6,0), +(65875,6,0), +(63041,6,0), +(62560,6,0), +(59099,6,1), +(44608,6,0), +(43702,6,0), +(43080,6,0), +(43056,6,0), +(40902,6,0), +(40657,6,0), +(28803,6,1), +(16054,6,0), +(8712,6,0), +(75863,7,1), +(75448,7,1), +(74412,7,1), +(74323,7,0), +(74322,7,0), +(74321,7,0), +(73028,7,0), +(72622,7,1), +(72621,7,1), +(72459,7,1), +(72273,7,0), +(72272,7,0), +(71618,7,0), +(71614,7,0), +(71279,7,1), +(70982,7,0), +(70981,7,0), +(70952,7,0), +(69540,7,0), +(67751,7,0), +(66905,7,0), +(66667,7,0), +(65126,7,0), +(64218,7,0), +(63059,7,0), +(62942,7,0), +(62705,7,0), +(61920,7,0), +(61715,7,0), +(61714,7,0), +(61632,7,0), +(60532,7,0), +(60430,7,0), +(59474,7,0), +(59465,7,0), +(57409,7,0), +(57405,7,0), +(57056,7,1), +(56694,7,0), +(56454,7,0), +(54160,7,0), +(53605,7,0), +(52319,7,0), +(51719,7,0), +(50747,7,0), +(50646,7,0), +(50645,7,0), +(50627,7,0), +(50218,7,0), +(49889,7,0), +(48742,7,0), +(48552,7,0), +(46158,7,0), +(42287,7,0), +(42265,7,1), +(42079,7,0), +(42004,7,1), +(41284,7,0), +(41113,7,0), +(41112,7,0), +(41111,7,0), +(41110,7,0), +(41071,7,0), +(41064,7,1), +(40931,7,0), +(40929,7,0), +(40905,7,0), +(40900,7,0), +(40851,7,0), +(40370,7,0), +(40172,7,0), +(40171,7,0), +(40170,7,0), +(40169,7,0), +(40075,7,1), +(39698,7,0), +(39686,7,0), +(39218,7,0), +(38920,7,0), +(38774,7,0), +(38484,7,0), +(38449,7,0), +(38371,7,0), +(37076,7,0), +(35957,7,1), +(35754,7,0), +(35289,7,0), +(34350,7,0), +(34187,7,0), +(31625,7,0), +(31624,7,0), +(31617,7,0), +(30939,7,1), +(30659,7,0), +(30657,7,0), +(30531,7,0), +(30098,7,0), +(28681,7,1), +(25790,7,0), +(25029,7,0), +(23015,7,0), +(22710,7,0), +(20553,7,0), +(10732,7,0), +(10348,7,0), +(7082,7,0), +(5628,7,0), +(804,7,0), +(802,7,0), +(54069,1,0), +(56251,1,0), +(58630,1,0); + +-- remove redundant entries +DELETE FROM `conditions` WHERE `ConditionTypeOrReference` = 18 AND `ConditionValue1` = 1 AND `ConditionValue2` = 0 AND `SourceEntry` IN (SELECT `id` FROM `temp_convert_spells` WHERE onlyPlayers); + +-- set source group if available in db +UPDATE `conditions` SET `SourceGroup` = `ConditionValue3`, `ConditionValue3` = 0 WHERE `ConditionTypeOrReference` = 18; + +-- set source group in case of old default (not set) source group +UPDATE `conditions` SET `SourceGroup` = (SELECT `effMask` FROM `temp_convert_spells` WHERE `id` = `SourceEntry`) WHERE `SourceGroup` = 0 AND `ConditionTypeOrReference` = 18; + +CREATE TABLE `temp_cond_vals` +( + `sourceGroup` INT(11), + `sourceEntry` INT(11), + `conditionValue1` INT(11), + `conditionValue2` INT(11), + `elseGroup` INT(11) AUTO_INCREMENT, + PRIMARY KEY (`sourceGroup`, `sourceEntry`, `elseGroup`) +) ENGINE=MYISAM; + +INSERT INTO `temp_cond_vals` (`sourceGroup`, `sourceEntry`, `conditionValue1`, `conditionValue2`) SELECT `SourceGroup`, `SourceEntry`, `ConditionValue1`, `ConditionValue2` FROM `conditions` WHERE `ConditionTypeOrReference` = 18; + +-- set correct else group +UPDATE `conditions` SET `ElseGroup` = (SELECT `elseGroup` FROM `temp_cond_vals` WHERE `sourceGroup` = `conditions`.`SourceGroup` AND `sourceEntry` = `conditions`.`SourceEntry` AND `conditionValue1` = `conditions`.`ConditionValue1` AND `conditionValue2` = `conditions`.`ConditionValue2`)-1 WHERE `ConditionTypeOrReference` = 18; + +-- old condition type 3 (caster's minion) +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`) +SELECT `SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `ElseGroup`, 33, 0, 1, 3 FROM `conditions` WHERE `ConditionTypeOrReference` = 18 AND `ConditionValue1` = 3; + +UPDATE `conditions` SET `ConditionTypeOrReference` = 31 WHERE `ConditionTypeOrReference` = 18 AND `ConditionValue1` = 3; + +-- old condition type 2 (dead creature) +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `NegativeCondition`) +SELECT `SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `ElseGroup`, 36, 0, 0, 0, 1 FROM `conditions` WHERE `ConditionTypeOrReference` = 18 AND `ConditionValue1` = 2; + +UPDATE `conditions` SET `ConditionTypeOrReference` = 31, `ConditionValue1` = 3 WHERE `ConditionTypeOrReference` = 18 AND `ConditionValue1` = 2; + +-- old condition type 1 (creature) +UPDATE `conditions` SET `ConditionTypeOrReference` = 31, `ConditionValue1` = 3 WHERE `ConditionTypeOrReference` = 18 AND `ConditionValue1` = 1 AND `ConditionValue2`; + +-- old condition type 1 (player) +UPDATE `conditions` SET `ConditionTypeOrReference` = 32, `ConditionValue1` = 0x90 WHERE `ConditionTypeOrReference` = 18 AND `ConditionValue1` = 1 AND NOT `ConditionValue2`; + +-- old condition type 0 (gameobject) +UPDATE `conditions` SET `ConditionTypeOrReference` = 31, `ConditionValue1` = 5 WHERE `ConditionTypeOrReference` = 18 AND `ConditionValue1` = 0; + +DROP TABLE `temp_convert_spells`; +DROP TABLE `temp_cond_vals`; \ No newline at end of file diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 550814ccf3f..af0c1a07c2b 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -26,6 +26,7 @@ #include "ConditionMgr.h" #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "Spell.h" // Checks if object meets the condition // Can have CONDITION_SOURCE_TYPE_NONE && !mReferenceId if called from a special event (ie: eventAI) @@ -94,14 +95,14 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) } case CONDITION_CLASS: { - if (Player* player = object->ToPlayer()) - condMeets = player->getClassMask() & ConditionValue1; + if (Unit* unit = object->ToUnit()) + condMeets = unit->getClassMask() & ConditionValue1; break; } case CONDITION_RACE: { - if (Player* player = object->ToPlayer()) - condMeets = player->getRaceMask() & ConditionValue1; + if (Unit* unit = object->ToUnit()) + condMeets = unit->getRaceMask() & ConditionValue1; break; } case CONDITION_SKILL: @@ -153,9 +154,6 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) condMeets = ((InstanceMap*)map)->GetInstanceScript()->GetData(ConditionValue1) == ConditionValue2; break; } - case CONDITION_SPELL_SCRIPT_TARGET: - condMeets = true;//spell target condition is handled in spellsystem, here it is always true - break; case CONDITION_MAPID: condMeets = object->GetMapId() == ConditionValue1; break; @@ -291,12 +289,153 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) return condMeets && script; } +uint32 Condition::GetSearcherTypeMaskForCondition() +{ + // build mask of types for which condition can return true + // this is used for speeding up gridsearches + if (NegativeCondition) + return (GRID_MAP_TYPE_MASK_ALL); + uint32 mask = 0; + switch (ConditionType) + { + case CONDITION_NONE: + mask |= GRID_MAP_TYPE_MASK_ALL; + break; + case CONDITION_AURA: + mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_ITEM: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_ITEM_EQUIPPED: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_ZONEID: + mask |= GRID_MAP_TYPE_MASK_ALL; + break; + case CONDITION_REPUTATION_RANK: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_ACHIEVEMENT: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_TEAM: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_CLASS: + mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_RACE: + mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_SKILL: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_QUESTREWARDED: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_QUESTTAKEN: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_QUEST_COMPLETE: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_QUEST_NONE: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_ACTIVE_EVENT: + mask |= GRID_MAP_TYPE_MASK_ALL; + break; + case CONDITION_INSTANCE_DATA: + mask |= GRID_MAP_TYPE_MASK_ALL; + break; + case CONDITION_MAPID: + mask |= GRID_MAP_TYPE_MASK_ALL; + break; + case CONDITION_AREAID: + mask |= GRID_MAP_TYPE_MASK_ALL; + break; + case CONDITION_SPELL: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_LEVEL: + mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_DRUNKENSTATE: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_NEAR_CREATURE: + mask |= GRID_MAP_TYPE_MASK_ALL; + break; + case CONDITION_NEAR_GAMEOBJECT: + mask |= GRID_MAP_TYPE_MASK_ALL; + break; + case CONDITION_OBJECT_ENTRY: + switch (ConditionValue1) + { + case TYPEID_UNIT: + mask |= GRID_MAP_TYPE_MASK_CREATURE; + break; + case TYPEID_PLAYER: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; + case TYPEID_GAMEOBJECT: + mask |= GRID_MAP_TYPE_MASK_GAMEOBJECT; + break; + case TYPEID_CORPSE: + mask |= GRID_MAP_TYPE_MASK_CORPSE; + break; + default: + break; + } + case CONDITION_TYPE_MASK: + if (ConditionValue1 & TYPEMASK_UNIT) + mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; + if (ConditionValue1 & TYPEMASK_PLAYER) + mask |= GRID_MAP_TYPE_MASK_PLAYER; + if (ConditionValue1 & TYPEMASK_GAMEOBJECT) + mask |= GRID_MAP_TYPE_MASK_GAMEOBJECT; + if (ConditionValue1 & TYPEMASK_CORPSE) + mask |= GRID_MAP_TYPE_MASK_CORPSE; + break; + case CONDITION_RELATION_TO: + mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_REACTION_TO: + mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_DISTANCE_TO: + mask |= GRID_MAP_TYPE_MASK_ALL; + break; + case CONDITION_ALIVE: + mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_HP_VAL: + mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_HP_PCT: + mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER; + break; + case CONDITION_WORLD_STATE: + mask |= GRID_MAP_TYPE_MASK_ALL; + break; + case CONDITION_PHASEMASK: + mask |= GRID_MAP_TYPE_MASK_ALL; + break; + default: + ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); + break; + } + return mask; +} + uint32 Condition::GetMaxAvailableConditionTargets() { // returns number of targets which are available for given source type switch(SourceType) { case CONDITION_SOURCE_TYPE_SPELL: + case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET: case CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE: case CONDITION_SOURCE_TYPE_VEHICLE_SPELL: case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT: @@ -327,8 +466,49 @@ ConditionList ConditionMgr::GetConditionReferences(uint32 refId) return conditions; } +uint32 ConditionMgr::GetSearcherTypeMaskForConditionList(ConditionList const& conditions) +{ + if (conditions.empty()) + return GRID_MAP_TYPE_MASK_ALL; + // groupId, typeMask + std::map ElseGroupStore; + for (ConditionList::const_iterator i = conditions.begin(); i != conditions.end(); ++i) + { + // no point of having not loaded conditions in list + ASSERT((*i)->isLoaded() && "ConditionMgr::GetSearcherTypeMaskForConditionList - not yet loaded condition found in list"); + std::map::const_iterator itr = ElseGroupStore.find((*i)->ElseGroup); + // group not filled yet, fill with widest mask possible + if (itr == ElseGroupStore.end()) + ElseGroupStore[(*i)->ElseGroup] = GRID_MAP_TYPE_MASK_ALL; + // no point of checking anymore, empty mask + else if (!(*itr).second) + continue; + + if ((*i)->ReferenceId) // handle reference + { + ConditionReferenceContainer::const_iterator ref = ConditionReferenceStore.find((*i)->ReferenceId); + ASSERT(ref != ConditionReferenceStore.end() && "ConditionMgr::GetSearcherTypeMaskForConditionList - incorrect reference"); + ElseGroupStore[(*i)->ElseGroup] &= GetSearcherTypeMaskForConditionList((*ref).second); + } + else // handle normal condition + { + // object will match conditions in one ElseGroupStore only when it matches all of them + // so, let's find a smallest possible mask which satisfies all conditions + ElseGroupStore[(*i)->ElseGroup] &= (*i)->GetSearcherTypeMaskForCondition(); + } + } + // object will match condition when one of the checks in ElseGroupStore is matching + // so, let's include all possible masks + uint32 mask = 0; + for (std::map::const_iterator i = ElseGroupStore.begin(); i != ElseGroupStore.end(); ++i) + mask |= i->second; + + return mask; +} + bool ConditionMgr::IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, ConditionList const& conditions) { + // groupId, groupCheckPassed std::map ElseGroupStore; for (ConditionList::const_iterator i = conditions.begin(); i != conditions.end(); ++i) { @@ -391,6 +571,32 @@ bool ConditionMgr::IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, Con return IsObjectMeetToConditionList(sourceInfo, conditions); } +bool ConditionMgr::CanHaveSourceGroupSet(ConditionSourceType sourceType) const +{ + return (sourceType == CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE || + sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU || + sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION || + sourceType == CONDITION_SOURCE_TYPE_VEHICLE_SPELL || + sourceType == CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET || + sourceType == CONDITION_SOURCE_TYPE_SMART_EVENT); +} + +bool ConditionMgr::CanHaveSourceIdSet(ConditionSourceType sourceType) const +{ + return (sourceType == CONDITION_SOURCE_TYPE_SMART_EVENT); +} + ConditionList ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry) { ConditionList spellCond; @@ -487,6 +693,7 @@ void ConditionMgr::LoadConditions(bool isReload) sLog->outString("Re-Loading `gossip_menu_option` Table for Conditions!"); sObjectMgr->LoadGossipMenuItems(); + sSpellMgr->UnloadSpellInfoImplicitTargetConditionLists(); } QueryResult result = WorldDatabase.Query("SELECT SourceTypeOrReferenceId, SourceGroup, SourceEntry, SourceId, ElseGroup, ConditionTypeOrReference, ConditionTarget, " @@ -583,16 +790,23 @@ void ConditionMgr::LoadConditions(bool isReload) } //Grouping is only allowed for some types (loot templates, gossip menus, gossip items) - if (cond->SourceGroup && !isGroupable(cond->SourceType)) + if (cond->SourceGroup && !CanHaveSourceGroupSet(cond->SourceType)) + { + sLog->outErrorDb("Condition type %u has not allowed value of SourceGroup = %u!", uint32(cond->SourceType), cond->SourceGroup); + delete cond; + continue; + } + if (cond->SourceId && !CanHaveSourceIdSet(cond->SourceType)) { - sLog->outErrorDb("Condition type %u has not allowed grouping %u!", uint32(cond->SourceType), cond->SourceGroup); + sLog->outErrorDb("Condition type %u has not allowed value of SourceId = %u!", uint32(cond->SourceType), cond->SourceId); delete cond; continue; } - else if (cond->SourceGroup) + + if (cond->SourceGroup) { bool valid = false; - //handle grouped conditions + // handle grouped conditions switch (cond->SourceType) { case CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE: @@ -637,6 +851,9 @@ void ConditionMgr::LoadConditions(bool isReload) case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION: valid = addToGossipMenuItems(cond); break; + case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET: + valid = addToSpellImplicitTargetConditions(cond); + break; case CONDITION_SOURCE_TYPE_VEHICLE_SPELL: { //if no list for vehicle create one @@ -771,6 +988,78 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond) return false; } +bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond) +{ + uint32 conditionEffMask = cond->SourceGroup; + SpellInfo* spellInfo = const_cast(sSpellMgr->GetSpellInfo(cond->SourceEntry)); + ASSERT(spellInfo); + std::list sharedMasks; + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + // check if effect is already a part of some shared mask + bool found = false; + for (std::list::iterator itr = sharedMasks.begin(); itr != sharedMasks.end(); ++itr) + { + if ((1<Effects[i].ImplicitTargetConditions; + for (uint8 effIndex = i+1; effIndex < MAX_SPELL_EFFECTS; ++effIndex) + { + if (spellInfo->Effects[effIndex].ImplicitTargetConditions == cmp) + sharedMask |= 1<::iterator itr = sharedMasks.begin(); itr != sharedMasks.end(); ++itr) + { + // some effect indexes should have same data + if (uint32 commonMask = *itr & conditionEffMask) + { + uint8 firstEffIndex = 0; + for (; firstEffIndex < MAX_SPELL_EFFECTS; ++firstEffIndex) + if ((1<Effects[firstEffIndex].ImplicitTargetConditions; + + // there's already data entry for that sharedMask + if (sharedList) + { + // we have overlapping masks in db + if (conditionEffMask != *itr) + { + sLog->outErrorDb("SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set - " + "effect masks are overlapping (all SourceGroup values having given bit set must be equal) - ignoring.", cond->SourceEntry, cond->SourceGroup); + return false; + } + } + // no data for shared mask, we can create new submask + else + { + // add new list, create new shared mask + sharedList = new ConditionList(); + for (uint8 i = firstEffIndex; i < MAX_SPELL_EFFECTS; ++i) + if ((1<Effects[i].ImplicitTargetConditions = sharedList; + } + sharedList->push_back(cond); + break; + } + } + return true; +} + bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (cond->SourceType == CONDITION_SOURCE_TYPE_NONE || cond->SourceType >= CONDITION_SOURCE_TYPE_MAX) @@ -985,64 +1274,48 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) } break; } - case CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET: + case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET: { - if (cond->ConditionType != CONDITION_SPELL_SCRIPT_TARGET) + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cond->SourceEntry); + if (!spellInfo) { - sLog->outErrorDb("SourceEntry %u in `condition` table, has ConditionType %u. Only CONDITION_SPELL_SCRIPT_TARGET(18) is valid for CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET(14), ignoring.", cond->SourceEntry, uint32(cond->ConditionType)); + sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } - SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->SourceEntry); - if (!spellProto) + if ((cond->SourceGroup > MAX_EFFECT_MASK) || !cond->SourceGroup) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); + sLog->outErrorDb("SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set , ignoring.", cond->SourceEntry, cond->SourceGroup); return false; } - bool targetfound = false; + uint32 origGroup = cond->SourceGroup; + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - if (spellProto->Effects[i].TargetA.GetTarget() == TARGET_UNIT_SRC_AREA_ENTRY || - spellProto->Effects[i].TargetB.GetTarget() == TARGET_UNIT_SRC_AREA_ENTRY || - spellProto->Effects[i].TargetA.GetTarget() == TARGET_UNIT_DEST_AREA_ENTRY || - spellProto->Effects[i].TargetB.GetTarget() == TARGET_UNIT_DEST_AREA_ENTRY || - spellProto->Effects[i].TargetA.GetTarget() == TARGET_UNIT_NEARBY_ENTRY || - spellProto->Effects[i].TargetB.GetTarget() == TARGET_UNIT_NEARBY_ENTRY || - spellProto->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_NEARBY_ENTRY || - spellProto->Effects[i].TargetB.GetTarget() == TARGET_GAMEOBJECT_NEARBY_ENTRY || - spellProto->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_SRC_AREA || - spellProto->Effects[i].TargetB.GetTarget() == TARGET_GAMEOBJECT_SRC_AREA || - spellProto->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_DEST_AREA || - spellProto->Effects[i].TargetB.GetTarget() == TARGET_GAMEOBJECT_DEST_AREA || - spellProto->Effects[i].TargetA.GetTarget() == TARGET_DEST_NEARBY_ENTRY || - spellProto->Effects[i].TargetB.GetTarget() == TARGET_DEST_NEARBY_ENTRY || - spellProto->Effects[i].TargetA.GetTarget() == TARGET_UNIT_CONE_ENTRY || - spellProto->Effects[i].TargetB.GetTarget() == TARGET_UNIT_CONE_ENTRY) + if (!((1<SourceGroup)) + continue; + + switch (spellInfo->Effects[i].TargetA.GetSelectionCategory()) { - targetfound = true; - //break; + case TARGET_SELECT_CATEGORY_NEARBY: + case TARGET_SELECT_CATEGORY_CONE: + case TARGET_SELECT_CATEGORY_AREA: + continue; } - else if (cond->ConditionValue3 & (1 << i)) + switch (spellInfo->Effects[i].TargetB.GetSelectionCategory()) { - cond->ConditionValue3 &= ~(1 << i); - sLog->outErrorDb("SourceEntry %u in `condition` table does not have any implicit target TARGET_UNIT_NEARBY_ENTRY(38) or TARGET_DEST_NEARBY_ENTRY (46)" - ", TARGET_UNIT_SRC_AREA_ENTRY(7), TARGET_UNIT_DEST_AREA_ENTRY(8), TARGET_UNIT_CONE_ENTRY(60), TARGET_GAMEOBJECT_NEARBY_ENTRY(40)" - "TARGET_GAMEOBJECT_SRC_AREA(51), TARGET_GAMEOBJECT_DEST_AREA(52) in effect %u", cond->SourceEntry, uint32(i)); + case TARGET_SELECT_CATEGORY_NEARBY: + case TARGET_SELECT_CATEGORY_CONE: + case TARGET_SELECT_CATEGORY_AREA: + continue; } + sLog->outErrorDb("SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i)); + cond->SourceGroup &= ~(1<ConditionValue3) // cond->mConditionValue3 already errored up there - { - sLog->outErrorDb("SourceEntry %u in `condition` table does not have any implicit target TARGET_UNIT_NEARBY_ENTRY(38) or TARGET_DEST_NEARBY_ENTRY (46)" - ", TARGET_UNIT_SRC_AREA_ENTRY(7), TARGET_UNIT_DEST_AREA_ENTRY(8), TARGET_UNIT_CONE_ENTRY(60), TARGET_GAMEOBJECT_NEARBY_ENTRY(40)" - "TARGET_GAMEOBJECT_SRC_AREA(51), TARGET_GAMEOBJECT_DEST_AREA(52)", cond->SourceEntry); - return false; - } - if ((cond->ConditionValue1 == SPELL_TARGET_TYPE_DEAD) && !spellProto->IsAllowingDeadTarget()) - { - sLog->outErrorDb("SourceEntry %u in `condition` table does have SPELL_TARGET_TYPE_DEAD specified but spell does not have SPELL_ATTR2_CAN_TARGET_DEAD", cond->SourceEntry); + // all effects were removed, no need to add the condition at all + if (!cond->SourceGroup) return false; - } break; } case CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE: @@ -1318,46 +1591,6 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) sLog->outErrorDb("Race condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } - case CONDITION_SPELL_SCRIPT_TARGET: - { - if (cond->ConditionValue1 >= MAX_SPELL_TARGET_TYPE) - { - sLog->outErrorDb("SpellTarget condition has non existing spell target type (%u), skipped", cond->ConditionValue1); - return false; - } - - switch (cond->ConditionValue1) - { - case SPELL_TARGET_TYPE_GAMEOBJECT: - { - if (cond->ConditionValue2 && !sObjectMgr->GetGameObjectTemplate(cond->ConditionValue2)) - { - sLog->outErrorDb("SpellTarget condition has non existing gameobject (%u) as target, skipped", cond->ConditionValue2); - return false; - } - break; - } - case SPELL_TARGET_TYPE_CONTROLLED: - case SPELL_TARGET_TYPE_CREATURE: - case SPELL_TARGET_TYPE_DEAD: - { - if (cond->ConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->ConditionValue2)) - { - sLog->outErrorDb("SpellTarget condition has non existing creature template entry (%u) as target, skipped", cond->ConditionValue2); - return false; - } - - const CreatureTemplate* cInfo = sObjectMgr->GetCreatureTemplate(cond->ConditionValue2); - if (cond->SourceEntry == 30427 && !cInfo->SkinLootId) - { - sLog->outErrorDb("SpellTarget condition has creature entry %u as a target of spellid 30427, but this creature has no skinlootid. Gas extraction will not work!, skipped", cond->ConditionValue2); - return false; - } - break; - } - } - break; - } case CONDITION_MAPID: { MapEntry const* me = sMapStore.LookupEntry(cond->ConditionValue1); @@ -1598,6 +1831,9 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) sLog->outErrorDb("Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } + case CONDITION_UNUSED_18: + sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_18 in `conditions` table - ignoring"); + return false; case CONDITION_UNUSED_19: sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_19 in `conditions` table - ignoring"); return false; diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 9911aa2a98a..a1c6146d0cf 100755 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -48,7 +48,7 @@ enum ConditionTypes CONDITION_CLASS = 15, // class 0 0 true if player's class is equal to class CONDITION_RACE = 16, // race 0 0 true if player's race is equal to race CONDITION_ACHIEVEMENT = 17, // achievement_id 0 0 true if achievement is complete - CONDITION_SPELL_SCRIPT_TARGET = 18, // SpellScriptTargetType, TargetEntry, 0 + CONDITION_UNUSED_18 = 18, // CONDITION_UNUSED_19 = 19, // CONDITION_UNUSED_20 = 20, // CONDITION_UNUSED_21 = 21, // @@ -87,7 +87,7 @@ enum ConditionSourceType CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE = 10, CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE = 11, CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE = 12, - CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET = 13, + CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET = 13, CONDITION_SOURCE_TYPE_GOSSIP_MENU = 14, CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION = 15, CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE = 16, @@ -173,6 +173,7 @@ struct Condition } bool Meets(ConditionSourceInfo& sourceInfo); + uint32 GetSearcherTypeMaskForCondition(); bool isLoaded() const { return ConditionType > CONDITION_NONE || ReferenceId; } uint32 GetMaxAvailableConditionTargets(); }; @@ -198,9 +199,12 @@ class ConditionMgr bool isConditionTypeValid(Condition* cond); ConditionList GetConditionReferences(uint32 refId); + uint32 GetSearcherTypeMaskForConditionList(ConditionList const& conditions); bool IsObjectMeetToConditions(WorldObject* object, ConditionList const& conditions); bool IsObjectMeetToConditions(WorldObject* object1, WorldObject* object2, ConditionList const& conditions); bool IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, ConditionList const& conditions); + bool CanHaveSourceGroupSet(ConditionSourceType sourceType) const; + bool CanHaveSourceIdSet(ConditionSourceType sourceType) const; ConditionList GetConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry); ConditionList GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId); ConditionList GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType); @@ -211,29 +215,10 @@ class ConditionMgr bool addToLootTemplate(Condition* cond, LootTemplate* loot); bool addToGossipMenus(Condition* cond); bool addToGossipMenuItems(Condition* cond); + bool addToSpellImplicitTargetConditions(Condition* cond); bool IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, ConditionList const& conditions); - bool isGroupable(ConditionSourceType sourceType) const - { - return (sourceType == CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE || - sourceType == CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE || - sourceType == CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE || - sourceType == CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE || - sourceType == CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE || - sourceType == CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE || - sourceType == CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE || - sourceType == CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE || - sourceType == CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE || - sourceType == CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE || - sourceType == CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE || - sourceType == CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE || - sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU || - sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION || sourceType == CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT || - sourceType == CONDITION_SOURCE_TYPE_VEHICLE_SPELL || - sourceType == CONDITION_SOURCE_TYPE_SMART_EVENT); - } - void Clean(); // free up resources std::list AllocatedMemoryStore; // some garbage collection :) diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index aadf9f44b0b..c98364ecb2d 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1085,9 +1085,9 @@ bool Object::PrintIndexError(uint32 index, bool set) const return false; } -bool Position::HasInLine(Unit const* target, float distance, float width) const +bool Position::HasInLine(WorldObject const* target, float width) const { - if (!HasInArc(M_PI, target) || !target->IsWithinDist3d(m_positionX, m_positionY, m_positionZ, distance)) + if (!HasInArc(M_PI, target)) return false; width += target->GetObjectSize(); float angle = GetRelativeAngle(target); @@ -1502,14 +1502,14 @@ bool WorldObject::IsInBetween(const WorldObject* obj1, const WorldObject* obj2, return (size * size) >= GetExactDist2dSq(obj1->GetPositionX() + cos(angle) * dist, obj1->GetPositionY() + sin(angle) * dist); } -bool WorldObject::isInFront(WorldObject const* target, float distance, float arc) const +bool WorldObject::isInFront(WorldObject const* target, float arc) const { - return IsWithinDist(target, distance) && HasInArc(arc, target); + return HasInArc(arc, target); } -bool WorldObject::isInBack(WorldObject const* target, float distance, float arc) const +bool WorldObject::isInBack(WorldObject const* target, float arc) const { - return IsWithinDist(target, distance) && !HasInArc(2 * M_PI - arc, target); + return !HasInArc(2 * M_PI - arc, target); } void WorldObject::GetRandomPoint(const Position &pos, float distance, float &rand_x, float &rand_y, float &rand_z) const diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index c14b7599d5f..7b3fcc4a337 100755 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -451,7 +451,7 @@ struct Position bool IsInDist(const Position* pos, float dist) const { return GetExactDistSq(pos) < dist * dist; } bool HasInArc(float arcangle, const Position* pos) const; - bool HasInLine(Unit const* target, float distance, float width) const; + bool HasInLine(WorldObject const* target, float width) const; std::string ToString() const; }; ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer); @@ -707,8 +707,8 @@ class WorldObject : public Object, public WorldLocation bool IsInRange(WorldObject const* obj, float minRange, float maxRange, bool is3D = true) const; bool IsInRange2d(float x, float y, float minRange, float maxRange) const; bool IsInRange3d(float x, float y, float z, float minRange, float maxRange) const; - bool isInFront(WorldObject const* target, float distance, float arc = M_PI) const; - bool isInBack(WorldObject const* target, float distance, float arc = M_PI) const; + bool isInFront(WorldObject const* target, float arc = M_PI) const; + bool isInBack(WorldObject const* target, float arc = M_PI) const; bool IsInBetween(const WorldObject* obj1, const WorldObject* obj2, float size = 0) const; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 47c3c1a9395..0e3e2f593fa 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10004,6 +10004,7 @@ Unit* Unit::GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo) && _IsValidAttackTarget(magnet, spellInfo) && IsWithinLOSInMap(magnet)) { + // TODO: handle this charge drop by proc in cast phase on explicit target (*itr)->GetBase()->DropCharge(AURA_REMOVE_BY_EXPIRE); return magnet; } @@ -16178,26 +16179,6 @@ bool Unit::IsInRaidWith(Unit const* unit) const return false; } -bool Unit::IsTargetMatchingCheck(Unit const* target, SpellTargetSelectionCheckTypes check) const -{ - switch (check) - { - case TARGET_SELECT_CHECK_ENEMY: - if (IsControlledByPlayer()) - return !IsFriendlyTo(target); - else - return IsHostileTo(target); - case TARGET_SELECT_CHECK_ALLY: - return IsFriendlyTo(target); - case TARGET_SELECT_CHECK_PARTY: - return IsInPartyWith(target); - case TARGET_SELECT_CHECK_RAID: - return IsInRaidWith(target); - default: - return true; - } -} - void Unit::GetRaidMember(std::list &nearMembers, float radius) { Player* owner = GetCharmerOrOwnerPlayerOrPlayerItself(); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 66b0bcbeb54..e55141a3bae 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1394,7 +1394,6 @@ class Unit : public WorldObject bool IsNeutralToAll() const; bool IsInPartyWith(Unit const* unit) const; bool IsInRaidWith(Unit const* unit) const; - bool IsTargetMatchingCheck(Unit const* target, SpellTargetSelectionCheckTypes check) const; void GetPartyMemberInDist(std::list &units, float dist); void GetPartyMembers(std::list &units); void GetRaidMember(std::list &units, float dist); diff --git a/src/server/game/Grids/GridDefines.h b/src/server/game/Grids/GridDefines.h index 8651680cb49..d096bb7ab63 100644 --- a/src/server/game/Grids/GridDefines.h +++ b/src/server/game/Grids/GridDefines.h @@ -65,6 +65,16 @@ typedef GridRefManager DynamicObjectMapType; typedef GridRefManager GameObjectMapType; typedef GridRefManager PlayerMapType; +enum GridMapTypeMask +{ + GRID_MAP_TYPE_MASK_CORPSE = 0x01, + GRID_MAP_TYPE_MASK_CREATURE = 0x02, + GRID_MAP_TYPE_MASK_DYNAMICOBJECT = 0x04, + GRID_MAP_TYPE_MASK_GAMEOBJECT = 0x08, + GRID_MAP_TYPE_MASK_PLAYER = 0x10, + GRID_MAP_TYPE_MASK_ALL = 0x1F +}; + typedef Grid GridType; typedef NGrid NGridType; diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp index 2446e9d4276..17d3066e64d 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp +++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp @@ -343,24 +343,17 @@ bool AnyDeadUnitObjectInRangeCheck::operator()(Creature* u) bool AnyDeadUnitSpellTargetInRangeCheck::operator()(Player* u) { - return AnyDeadUnitObjectInRangeCheck::operator()(u) - && (i_spellInfo->CheckTarget(i_searchObj, u, true) == SPELL_CAST_OK) - && i_searchObj->IsTargetMatchingCheck(u, i_check); + return AnyDeadUnitObjectInRangeCheck::operator()(u) && i_check(u); } bool AnyDeadUnitSpellTargetInRangeCheck::operator()(Corpse* u) { - Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGUID()); - return owner && AnyDeadUnitObjectInRangeCheck::operator()(u) - && (i_spellInfo->CheckTarget(i_searchObj, owner, true) == SPELL_CAST_OK) - && i_searchObj->IsTargetMatchingCheck(owner, i_check); + return AnyDeadUnitObjectInRangeCheck::operator()(u) && i_check(u); } bool AnyDeadUnitSpellTargetInRangeCheck::operator()(Creature* u) { - return AnyDeadUnitObjectInRangeCheck::operator()(u) - && (i_spellInfo->CheckTarget(i_searchObj, u, true) == SPELL_CAST_OK) - && i_searchObj->IsTargetMatchingCheck(u, i_check); + return AnyDeadUnitObjectInRangeCheck::operator()(u) && i_check(u); } template void ObjectUpdater::Visit(GameObjectMapType &); diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 12e3fda0484..21f27d6a453 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -30,6 +30,7 @@ #include "Player.h" #include "Unit.h" #include "CreatureAI.h" +#include "Spell.h" class Player; //class Map; @@ -168,12 +169,33 @@ namespace Trinity template struct WorldObjectSearcher { + uint32 i_mapTypeMask; uint32 i_phaseMask; WorldObject* &i_object; Check &i_check; - WorldObjectSearcher(WorldObject const* searcher, WorldObject* & result, Check& check) - : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) {} + WorldObjectSearcher(WorldObject const* searcher, WorldObject* & result, Check& check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL) + : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check), i_mapTypeMask(mapTypeMask) {} + + void Visit(GameObjectMapType &m); + void Visit(PlayerMapType &m); + void Visit(CreatureMapType &m); + void Visit(CorpseMapType &m); + void Visit(DynamicObjectMapType &m); + + template void Visit(GridRefManager &) {} + }; + + template + struct WorldObjectLastSearcher + { + uint32 i_mapTypeMask; + uint32 i_phaseMask; + WorldObject* &i_object; + Check &i_check; + + WorldObjectLastSearcher(WorldObject const* searcher, WorldObject* & result, Check& check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL) + : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check), i_mapTypeMask(mapTypeMask) {} void Visit(GameObjectMapType &m); void Visit(PlayerMapType &m); @@ -187,12 +209,13 @@ namespace Trinity template struct WorldObjectListSearcher { + uint32 i_mapTypeMask; uint32 i_phaseMask; std::list &i_objects; Check& i_check; - WorldObjectListSearcher(WorldObject const* searcher, std::list &objects, Check & check) - : i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check) {} + WorldObjectListSearcher(WorldObject const* searcher, std::list &objects, Check & check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL) + : i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check), i_mapTypeMask(mapTypeMask) {} void Visit(PlayerMapType &m); void Visit(CreatureMapType &m); @@ -206,14 +229,17 @@ namespace Trinity template struct WorldObjectWorker { + uint32 i_mapTypeMask; uint32 i_phaseMask; Do const& i_do; - WorldObjectWorker(WorldObject const* searcher, Do const& _do) - : i_phaseMask(searcher->GetPhaseMask()), i_do(_do) {} + WorldObjectWorker(WorldObject const* searcher, Do const& _do, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL) + : i_phaseMask(searcher->GetPhaseMask()), i_do(_do), i_mapTypeMask(mapTypeMask) {} void Visit(GameObjectMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT)) + return; for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if (itr->getSource()->InSamePhase(i_phaseMask)) i_do(itr->getSource()); @@ -221,12 +247,16 @@ namespace Trinity void Visit(PlayerMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER)) + return; for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if (itr->getSource()->InSamePhase(i_phaseMask)) i_do(itr->getSource()); } void Visit(CreatureMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE)) + return; for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if (itr->getSource()->InSamePhase(i_phaseMask)) i_do(itr->getSource()); @@ -234,6 +264,8 @@ namespace Trinity void Visit(CorpseMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE)) + return; for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if (itr->getSource()->InSamePhase(i_phaseMask)) i_do(itr->getSource()); @@ -241,6 +273,8 @@ namespace Trinity void Visit(DynamicObjectMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT)) + return; for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if (itr->getSource()->InSamePhase(i_phaseMask)) i_do(itr->getSource()); @@ -527,73 +561,11 @@ namespace Trinity // CHECKS && DO classes // WorldObject check classes - class RaiseDeadObjectCheck - { - public: - RaiseDeadObjectCheck(Unit* source, float range) : _source(source), _range(range) {} - bool operator()(Creature* u) - { - if (_source->GetTypeId() != TYPEID_PLAYER || !((Player*)_source)->isHonorOrXPTarget(u) || - u->getDeathState() != CORPSE || - (u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0 || - (u->GetDisplayId() != u->GetNativeDisplayId())) - return false; - - return _source->IsWithinDistInMap(u, _range); - } - bool operator()(Player* u) - { - if (_source == u || _source->GetTypeId() != TYPEID_PLAYER || !((Player*)_source)->isHonorOrXPTarget(u) || - u->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST) || u->isInFlight() || !u->isDead() || - (u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0) - return false; - return _source->IsWithinDistInMap(u, _range); - } - - bool operator()(Corpse* u) - { - if (_source->GetTypeId() != TYPEID_PLAYER || u->GetType() == CORPSE_BONES) - return false; - - return _source->IsWithinDistInMap(u, _range); - } - template bool operator()(NOT_INTERESTED*) { return false; } - private: - Unit* const _source; - float _range; - }; - - class ExplodeCorpseObjectCheck - { - public: - ExplodeCorpseObjectCheck(Unit* funit, float range) : i_funit(funit), i_range(range) {} - bool operator()(Player* u) - { - if (u->getDeathState() != CORPSE || u->isInFlight() || - u->HasAuraType(SPELL_AURA_GHOST) || (u->GetDisplayId() != u->GetNativeDisplayId())) - return false; - - return i_funit->IsWithinDistInMap(u, i_range); - } - bool operator()(Creature* u) - { - if (u->getDeathState() != CORPSE || u->isInFlight() || - (u->GetDisplayId() != u->GetNativeDisplayId()) || - (u->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL) != 0) - return false; - - return i_funit->IsWithinDistInMap(u, i_range); - } - template bool operator()(NOT_INTERESTED*) { return false; } - private: - Unit* const i_funit; - float i_range; - }; class AnyDeadUnitObjectInRangeCheck { public: - AnyDeadUnitObjectInRangeCheck(Unit const* searchObj, float range) : i_searchObj(searchObj), i_range(range) {} + AnyDeadUnitObjectInRangeCheck(Unit* searchObj, float range) : i_searchObj(searchObj), i_range(range) {} bool operator()(Player* u); bool operator()(Corpse* u); bool operator()(Creature* u); @@ -606,15 +578,16 @@ namespace Trinity class AnyDeadUnitSpellTargetInRangeCheck : public AnyDeadUnitObjectInRangeCheck { public: - AnyDeadUnitSpellTargetInRangeCheck(Unit const* searchObj, float range, SpellInfo const* spellInfo, SpellTargetSelectionCheckTypes check) - : AnyDeadUnitObjectInRangeCheck(searchObj, range), i_spellInfo(spellInfo), i_check(check) {} + AnyDeadUnitSpellTargetInRangeCheck(Unit* searchObj, float range, SpellInfo const* spellInfo, SpellTargetCheckTypes check) + : AnyDeadUnitObjectInRangeCheck(searchObj, range), i_spellInfo(spellInfo), i_check(searchObj, searchObj, spellInfo, check, NULL) + {} bool operator()(Player* u); bool operator()(Corpse* u); bool operator()(Creature* u); template bool operator()(NOT_INTERESTED*) { return false; } protected: SpellInfo const* i_spellInfo; - SpellTargetSelectionCheckTypes i_check; + WorldObjectSpellTargetCheck i_check; }; // WorldObject do classes diff --git a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h index 34fe7757c5f..40b3863679b 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h +++ b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h @@ -51,6 +51,9 @@ inline void Trinity::ObjectUpdater::Visit(CreatureMapType &m) template void Trinity::WorldObjectSearcher::Visit(GameObjectMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT)) + return; + // already found if (i_object) return; @@ -71,6 +74,9 @@ void Trinity::WorldObjectSearcher::Visit(GameObjectMapType &m) template void Trinity::WorldObjectSearcher::Visit(PlayerMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER)) + return; + // already found if (i_object) return; @@ -91,6 +97,9 @@ void Trinity::WorldObjectSearcher::Visit(PlayerMapType &m) template void Trinity::WorldObjectSearcher::Visit(CreatureMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE)) + return; + // already found if (i_object) return; @@ -111,6 +120,9 @@ void Trinity::WorldObjectSearcher::Visit(CreatureMapType &m) template void Trinity::WorldObjectSearcher::Visit(CorpseMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE)) + return; + // already found if (i_object) return; @@ -131,6 +143,9 @@ void Trinity::WorldObjectSearcher::Visit(CorpseMapType &m) template void Trinity::WorldObjectSearcher::Visit(DynamicObjectMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT)) + return; + // already found if (i_object) return; @@ -148,9 +163,93 @@ void Trinity::WorldObjectSearcher::Visit(DynamicObjectMapType &m) } } + +template +void Trinity::WorldObjectLastSearcher::Visit(GameObjectMapType &m) +{ + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT)) + return; + + for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + { + if (!itr->getSource()->InSamePhase(i_phaseMask)) + continue; + + if (i_check(itr->getSource())) + i_object = itr->getSource(); + } +} + +template +void Trinity::WorldObjectLastSearcher::Visit(PlayerMapType &m) +{ + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER)) + return; + + for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + { + if (!itr->getSource()->InSamePhase(i_phaseMask)) + continue; + + if (i_check(itr->getSource())) + i_object = itr->getSource(); + } +} + +template +void Trinity::WorldObjectLastSearcher::Visit(CreatureMapType &m) +{ + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE)) + return; + + for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + { + if (!itr->getSource()->InSamePhase(i_phaseMask)) + continue; + + if (i_check(itr->getSource())) + i_object = itr->getSource(); + } +} + +template +void Trinity::WorldObjectLastSearcher::Visit(CorpseMapType &m) +{ + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE)) + return; + + for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + { + if (!itr->getSource()->InSamePhase(i_phaseMask)) + continue; + + if (i_check(itr->getSource())) + i_object = itr->getSource(); + } +} + +template +void Trinity::WorldObjectLastSearcher::Visit(DynamicObjectMapType &m) +{ + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT)) + return; + + for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + { + if (!itr->getSource()->InSamePhase(i_phaseMask)) + continue; + + if (i_check(itr->getSource())) + i_object = itr->getSource(); + } +} + template void Trinity::WorldObjectListSearcher::Visit(PlayerMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER)) + return; + for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) @@ -160,6 +259,9 @@ void Trinity::WorldObjectListSearcher::Visit(PlayerMapType &m) template void Trinity::WorldObjectListSearcher::Visit(CreatureMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE)) + return; + for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) @@ -169,6 +271,9 @@ void Trinity::WorldObjectListSearcher::Visit(CreatureMapType &m) template void Trinity::WorldObjectListSearcher::Visit(CorpseMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE)) + return; + for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) @@ -178,6 +283,9 @@ void Trinity::WorldObjectListSearcher::Visit(CorpseMapType &m) template void Trinity::WorldObjectListSearcher::Visit(GameObjectMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT)) + return; + for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) @@ -187,6 +295,9 @@ void Trinity::WorldObjectListSearcher::Visit(GameObjectMapType &m) template void Trinity::WorldObjectListSearcher::Visit(DynamicObjectMapType &m) { + if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT)) + return; + for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr) if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 53356772ff6..207ab2b663d 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -592,19 +592,6 @@ Spell::~Spell() CheckEffectExecuteData(); } -template -WorldObject* Spell::FindCorpseUsing() -{ - // non-standard target selection - float max_range = m_spellInfo->GetMaxRange(false); - - WorldObject* result = NULL; - T u_check(m_caster, max_range); - Trinity::WorldObjectSearcher searcher(m_caster, result, u_check); - m_caster->GetMap()->VisitFirstFound(m_caster->GetPositionX(), m_caster->GetPositionY(), max_range, searcher); - return result; -} - void Spell::InitExplicitTargets(SpellCastTargets const& targets) { m_targets = targets; @@ -707,7 +694,8 @@ void Spell::SelectSpellTargets() { // select targets for cast phase SelectExplicitTargets(); - uint32 processedTargets = 0; + + uint32 processedAreaEffectsMask = 0; for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) { // not call for empty effect. @@ -715,9 +703,6 @@ void Spell::SelectSpellTargets() if (!m_spellInfo->Effects[i].IsEffect()) continue; - if (processedTargets & (1 << i)) - continue; - // set expected type of implicit targets to be sent to client uint32 implicitTargetMask = GetTargetFlagMask(m_spellInfo->Effects[i].TargetA.GetObjectType()) | GetTargetFlagMask(m_spellInfo->Effects[i].TargetB.GetObjectType()); if (implicitTargetMask & TARGET_FLAG_UNIT) @@ -725,13 +710,8 @@ void Spell::SelectSpellTargets() if (implicitTargetMask & (TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_GAMEOBJECT_ITEM)) m_targets.SetTargetFlag(TARGET_FLAG_GAMEOBJECT); - uint32 targetA = m_spellInfo->Effects[i].TargetA.GetTarget(); - uint32 targetB = m_spellInfo->Effects[i].TargetB.GetTarget(); - - if (targetA) - processedTargets |= SelectEffectTargets(i, m_spellInfo->Effects[i].TargetA); - if (targetB) - processedTargets |= SelectEffectTargets(i, m_spellInfo->Effects[i].TargetB); + SelectEffectImplicitTargets(SpellEffIndex(i), m_spellInfo->Effects[i].TargetA, processedAreaEffectsMask); + SelectEffectImplicitTargets(SpellEffIndex(i), m_spellInfo->Effects[i].TargetB, processedAreaEffectsMask); // Select targets of effect based on effect type // those are used when no valid target could be added for spell effect based on spell target type @@ -793,2074 +773,2101 @@ void Spell::SelectSpellTargets() } } -void Spell::SelectEffectTypeImplicitTargets(uint8 effIndex) +void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32& processedEffectMask) { - // special case for SPELL_EFFECT_SUMMON_RAF_FRIEND and SPELL_EFFECT_SUMMON_PLAYER - // TODO: this is a workaround - target shouldn't be stored in target map for those spells - switch (m_spellInfo->Effects[effIndex].Effect) + if (!targetType.GetTarget()) + return; + + uint32 effectMask = 1 << effIndex; + // set the same target list for all effects + // some spells appear to need this, however this requires more research + switch (targetType.GetSelectionCategory()) { - case SPELL_EFFECT_SUMMON_RAF_FRIEND: - case SPELL_EFFECT_SUMMON_PLAYER: - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->GetSelection()) + case TARGET_SELECT_CATEGORY_NEARBY: + case TARGET_SELECT_CATEGORY_CONE: + case TARGET_SELECT_CATEGORY_AREA: + // targets for effect already selected + if (effectMask & processedEffectMask) + return; + // choose which targets we can select at once + for (uint32 j = effIndex + 1; j < MAX_SPELL_EFFECTS; ++j) + if (GetSpellInfo()->Effects[effIndex].TargetA.GetTarget() == GetSpellInfo()->Effects[j].TargetA.GetTarget() && + GetSpellInfo()->Effects[effIndex].TargetB.GetTarget() == GetSpellInfo()->Effects[j].TargetB.GetTarget() && + GetSpellInfo()->Effects[effIndex].ImplicitTargetConditions == GetSpellInfo()->Effects[j].ImplicitTargetConditions && + GetSpellInfo()->Effects[effIndex].CalcRadius(m_caster) == GetSpellInfo()->Effects[j].CalcRadius(m_caster)) + effectMask |= 1 << j; + processedEffectMask |= effectMask; + } + + switch(targetType.GetSelectionCategory()) + { + case TARGET_SELECT_CATEGORY_CHANNEL: + SelectImplicitChannelTargets(effIndex, targetType); + break; + case TARGET_SELECT_CATEGORY_NEARBY: + SelectImplicitNearbyTargets(effIndex, targetType, effectMask); + break; + case TARGET_SELECT_CATEGORY_CONE: + SelectImplicitConeTargets(effIndex, targetType, effectMask); + break; + case TARGET_SELECT_CATEGORY_AREA: + SelectImplicitAreaTargets(effIndex, targetType, effectMask); + break; + case TARGET_SELECT_CATEGORY_DEFAULT: + switch (targetType.GetObjectType()) { - Player* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetSelection()); - if (target) - AddUnitTarget(target, 1 << effIndex, false); + case TARGET_OBJECT_TYPE_SRC: + switch(targetType.GetReferenceType()) + { + case TARGET_REFERENCE_TYPE_CASTER: + m_targets.SetSrc(*m_caster); + break; + default: + ASSERT("Spell::SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_SRC"); + break; + } + break; + case TARGET_OBJECT_TYPE_DEST: + switch(targetType.GetReferenceType()) + { + case TARGET_REFERENCE_TYPE_CASTER: + SelectImplicitCasterDestTargets(effIndex, targetType); + break; + case TARGET_REFERENCE_TYPE_TARGET: + SelectImplicitCasterDestTargets(effIndex, targetType); + break; + case TARGET_REFERENCE_TYPE_DEST: + SelectImplicitDestDestTargets(effIndex, targetType); + break; + default: + ASSERT("Spell::SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_DEST"); + break; + } + break; + default: + switch(targetType.GetReferenceType()) + { + case TARGET_REFERENCE_TYPE_CASTER: + SelectImplicitCasterObjectTargets(effIndex, targetType); + break; + case TARGET_REFERENCE_TYPE_TARGET: + SelectImplicitTargetObjectTargets(effIndex, targetType); + break; + default: + ASSERT("Spell::SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT"); + break; + } + break; } - return; + break; + case TARGET_SELECT_CATEGORY_NYI: + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: target type %u, found in spellID %u, effect %u is not implemented yet!", m_spellInfo->Id, effIndex, targetType.GetTarget()); + break; default: + ASSERT(false && "Spell::SelectEffectImplicitTargets: received not implemented select target category"); break; } +} - // select spell implicit targets based on effect type - if (!m_spellInfo->Effects[effIndex].GetImplicitTargetType()) +void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) +{ + if (targetType.GetReferenceType() != TARGET_REFERENCE_TYPE_CASTER) + { + ASSERT(false && "Spell::SelectImplicitChannelTargets: received not implemented target reference type"); return; + } - uint32 targetMask = m_spellInfo->Effects[effIndex].GetMissingTargetMask(); - - if (!targetMask) + Spell* channeledSpell = m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL); + if (!channeledSpell) + { + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::SelectImplicitChannelTargets: cannot find channel spell for spell ID %u, effect %u", m_spellInfo->Id, effIndex); return; - - switch (m_spellInfo->Effects[effIndex].GetImplicitTargetType()) + } + switch (targetType.GetType()) { - // add explicit object target or self to the target map - case EFFECT_IMPLICIT_TARGET_EXPLICIT: - // player which not released his spirit is Unit, but target flag for it is TARGET_FLAG_CORPSE_MASK - if (targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK)) - { - if (Unit* unitTarget = m_targets.GetUnitTarget()) - AddUnitTarget(unitTarget, 1 << effIndex, false); - else if (targetMask & TARGET_FLAG_CORPSE_MASK) - { - if (Corpse* corpseTarget = m_targets.GetCorpseTarget()) - { - // TODO: this is a workaround - corpses should be added to spell target map too, but we can't do that so we add owner instead - if (Player* owner = ObjectAccessor::FindPlayer(corpseTarget->GetOwnerGUID())) - AddUnitTarget(owner, 1 << effIndex, false); - } - } - else //if (targetMask & TARGET_FLAG_UNIT_MASK) - { - AddUnitTarget(m_caster, 1 << effIndex, false); - } - } - if (targetMask & TARGET_FLAG_ITEM_MASK) - { - if (Item* itemTarget = m_targets.GetItemTarget()) - AddItemTarget(itemTarget, 1 << effIndex); - } - if (targetMask & TARGET_FLAG_GAMEOBJECT_MASK) - { - if (GameObject* gObjTarget = m_targets.GetGOTarget()) - AddGOTarget(gObjTarget, 1 << effIndex); - } + case TARGET_UNIT_CHANNEL_TARGET: + // unit target may be no longer avalible - teleported out of map for example + if (Unit* target = Unit::GetUnit(*m_caster, channeledSpell->m_targets.GetUnitTargetGUID())) + AddUnitTarget(target, 1 << effIndex); + else + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell target for spell ID %u, effect %u", m_spellInfo->Id, effIndex); break; - // add self to the target map - case EFFECT_IMPLICIT_TARGET_CASTER: - if (targetMask & TARGET_FLAG_UNIT_MASK) - AddUnitTarget(m_caster, 1 << effIndex, false); + case TARGET_DEST_CHANNEL_TARGET: + if (channeledSpell->m_targets.HasDst()) + m_targets.SetDst(channeledSpell->m_targets); + else if (WorldObject* target = ObjectAccessor::GetWorldObject(*m_caster, channeledSpell->m_targets.GetObjectTargetGUID())) + m_targets.SetDst(*target); + else + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell destination for spell ID %u, effect %u", m_spellInfo->Id, effIndex); + break; + case TARGET_DEST_CHANNEL_CASTER: + m_targets.SetDst(*channeledSpell->GetCaster()); break; default: + ASSERT(false && "Spell::SelectImplicitChannelTargets: received not implemented target type"); break; } } -void Spell::prepareDataForTriggerSystem(AuraEffect const* /*triggeredByAura*/) +void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask) { - //========================================================================================== - // Now fill data for trigger system, need know: - // can spell trigger another or not (m_canTrigger) - // Create base triggers flags for Attacker and Victim (m_procAttacker, m_procVictim and m_procEx) - //========================================================================================== + if (targetType.GetReferenceType() != TARGET_REFERENCE_TYPE_CASTER) + { + ASSERT(false && "Spell::SelectImplicitNearbyTargets: received not implemented target reference type"); + return; + } - m_procVictim = m_procAttacker = 0; - // Get data for type of attack and fill base info for trigger - switch (m_spellInfo->DmgClass) + float range; + switch (targetType.GetCheckType()) { - case SPELL_DAMAGE_CLASS_MELEE: - m_procAttacker = PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS; - if (m_attackType == OFF_ATTACK) - m_procAttacker |= PROC_FLAG_DONE_OFFHAND_ATTACK; - else - m_procAttacker |= PROC_FLAG_DONE_MAINHAND_ATTACK; - m_procVictim = PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS; + case TARGET_CHECK_ENEMY: + range = m_spellInfo->GetMaxRange(false, m_caster, this); break; - case SPELL_DAMAGE_CLASS_RANGED: - // Auto attack - if (m_spellInfo->AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG) - { - m_procAttacker = PROC_FLAG_DONE_RANGED_AUTO_ATTACK; - m_procVictim = PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK; - } - else // Ranged spell attack - { - m_procAttacker = PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS; - m_procVictim = PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS; - } + case TARGET_CHECK_ALLY: + case TARGET_CHECK_PARTY: + case TARGET_CHECK_RAID: + case TARGET_CHECK_RAID_CLASS: + range = m_spellInfo->GetMaxRange(true, m_caster, this); + break; + case TARGET_CHECK_ENTRY: + case TARGET_CHECK_DEFAULT: + range = m_spellInfo->GetMaxRange(m_spellInfo->IsPositive(), m_caster, this); break; default: - if (m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && - m_spellInfo->EquippedItemSubClassMask & (1<AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG) // Wands auto attack - { - m_procAttacker = PROC_FLAG_DONE_RANGED_AUTO_ATTACK; - m_procVictim = PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK; - } - // For other spells trigger procflags are set in Spell::DoAllEffectOnTarget - // Because spell positivity is dependant on target + ASSERT(false && "Spell::SelectImplicitNearbyTargets: received not implemented selection check type"); + break; } - m_procEx = PROC_EX_NONE; - - // Hunter trap spells - activation proc for Lock and Load, Entrapment and Misdirection - if (m_spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && - (m_spellInfo->SpellFamilyFlags[0] & 0x18 || // Freezing and Frost Trap, Freezing Arrow - m_spellInfo->Id == 57879 || // Snake Trap - done this way to avoid double proc - m_spellInfo->SpellFamilyFlags[2] & 0x00024000)) // Explosive and Immolation Trap - m_procAttacker |= PROC_FLAG_DONE_TRAP_ACTIVATION; + ConditionList* condList = m_spellInfo->Effects[effIndex].ImplicitTargetConditions; - /* Effects which are result of aura proc from triggered spell cannot proc - to prevent chain proc of these spells */ + // handle emergency case - try to use other provided targets if no conditions provided + if (targetType.GetCheckType() == TARGET_CHECK_ENTRY && !condList || condList->empty()) + { + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::SelectImplicitNearbyTargets: no conditions entry for target with TARGET_CHECK_ENTRY of spell ID %u, effect %u - selecting default targets", m_spellInfo->Id, effIndex); + switch (targetType.GetObjectType()) + { + case TARGET_OBJECT_TYPE_GOBJ: + if (m_spellInfo->RequiresSpellFocus) + { + if (focusObject) + AddGOTarget(focusObject, effMask); + return; + } + break; + case TARGET_OBJECT_TYPE_DEST: + if (m_spellInfo->RequiresSpellFocus) + { + if (focusObject) + m_targets.SetDst(*focusObject); + return; + } + break; + default: + break; + } + } - // Hellfire Effect - trigger as DOT - if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[0] & 0x00000040) + WorldObject* target = SearchNearbyTarget(range, targetType.GetObjectType(), targetType.GetCheckType(), condList); + if (!target) { - m_procAttacker = PROC_FLAG_DONE_PERIODIC; - m_procVictim = PROC_FLAG_TAKEN_PERIODIC; + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::SelectImplicitNearbyTargets: cannot find nearby target for spell ID %u, effect %u", m_spellInfo->Id, effIndex); + return; } - // Ranged autorepeat attack is set as triggered spell - ignore it - if (!(m_procAttacker & PROC_FLAG_DONE_RANGED_AUTO_ATTACK)) + switch (targetType.GetObjectType()) { - if (_triggeredCastFlags & TRIGGERED_DISALLOW_PROC_EVENTS && - (m_spellInfo->AttributesEx2 & SPELL_ATTR2_TRIGGERED_CAN_TRIGGER_PROC || - m_spellInfo->AttributesEx3 & SPELL_ATTR3_TRIGGERED_CAN_TRIGGER_PROC_2)) - m_procEx |= PROC_EX_INTERNAL_CANT_PROC; - else if (_triggeredCastFlags & TRIGGERED_DISALLOW_PROC_EVENTS) - m_procEx |= PROC_EX_INTERNAL_TRIGGERED; + case TARGET_OBJECT_TYPE_UNIT: + if (Unit* unitTarget = target->ToUnit()) + AddUnitTarget(unitTarget, effMask, false); + break; + case TARGET_OBJECT_TYPE_GOBJ: + if (GameObject* gobjTarget = target->ToGameObject()) + AddGOTarget(gobjTarget, effMask); + break; + case TARGET_OBJECT_TYPE_DEST: + m_targets.SetDst(*target); + break; + default: + ASSERT(false && "Spell::SelectImplicitNearbyTargets: received not implemented target object type"); + break; } - // Totem casts require spellfamilymask defined in spell_proc_event to proc - if (m_originalCaster && m_caster != m_originalCaster && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isTotem() && m_caster->IsControlledByPlayer()) - m_procEx |= PROC_EX_INTERNAL_REQ_FAMILY; -} -void Spell::CleanupTargetList() -{ - m_UniqueTargetInfo.clear(); - m_UniqueGOTargetInfo.clear(); - m_UniqueItemInfo.clear(); - m_delayMoment = 0; + SelectImplicitChainTargets(effIndex, targetType, target, effMask); } -void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= true*/) +void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask) { - for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) - if (!m_spellInfo->Effects[effIndex].IsEffect() || !CheckEffectTarget(target, effIndex)) - effectMask &= ~(1 << effIndex); - - // no effects left - if (!effectMask) + if (targetType.GetReferenceType() != TARGET_REFERENCE_TYPE_CASTER) + { + ASSERT(false && "Spell::SelectImplicitConeTargets: received not implemented target reference type"); return; + } + std::list targets; + SpellTargetObjectTypes objectType = targetType.GetObjectType(); + SpellTargetCheckTypes selectionType = targetType.GetCheckType(); + ConditionList* condList = m_spellInfo->Effects[effIndex].ImplicitTargetConditions; + float coneAngle = M_PI/2; + float radius = m_spellInfo->Effects[effIndex].CalcRadius(m_caster) * m_spellValue->RadiusMod; - if (checkIfValid) - if (m_spellInfo->CheckTarget(m_caster, target, true) != SPELL_CAST_OK) - return; + if (uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList)) + { + Trinity::WorldObjectSpellConeTargetCheck check(coneAngle, radius, m_caster, m_spellInfo, selectionType, condList); + Trinity::WorldObjectListSearcher searcher(m_caster, targets, check, containerTypeMask); + SearchTargets > (searcher, containerTypeMask, m_caster, m_caster, radius); - // Check for effect immune skip if immuned - for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) - if (target->IsImmunedToSpellEffect(m_spellInfo, effIndex)) - effectMask &= ~(1 << effIndex); + if (!targets.empty()) + { + // Other special target selection goes here + if (uint32 maxTargets = m_spellValue->MaxAffectedTargets) + { + Unit::AuraEffectList const& Auras = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_MAX_AFFECTED_TARGETS); + for (Unit::AuraEffectList::const_iterator j = Auras.begin(); j != Auras.end(); ++j) + if ((*j)->IsAffectedOnSpell(m_spellInfo)) + maxTargets += (*j)->GetAmount(); - uint64 targetGUID = target->GetGUID(); + Trinity::RandomResizeList(targets, maxTargets); + } - // Lookup target in already in list - for (std::list::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + // for compability with older code - add only unit and go targets + // TODO: remove this + std::list unitTargets; + std::list gObjTargets; + + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) + { + if (Unit* unitTarget = (*itr)->ToUnit()) + unitTargets.push_back(unitTarget); + else if (GameObject* gObjTarget = (*itr)->ToGameObject()) + gObjTargets.push_back(gObjTarget); + } + + CallScriptAfterUnitTargetSelectHandlers(unitTargets, effIndex); + + for (std::list::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr) + AddUnitTarget(*itr, effMask, false); + + for (std::list::iterator itr = gObjTargets.begin(); itr != gObjTargets.end(); ++itr) + AddGOTarget(*itr, effMask); + } + } +} + +void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask) +{ + Unit* referer = NULL; + switch (targetType.GetReferenceType()) { - if (targetGUID == ihit->targetGUID) // Found in list + case TARGET_REFERENCE_TYPE_SRC: + case TARGET_REFERENCE_TYPE_DEST: + case TARGET_REFERENCE_TYPE_CASTER: + referer = m_caster; + break; + case TARGET_REFERENCE_TYPE_TARGET: + referer = m_targets.GetUnitTarget(); + break; + case TARGET_REFERENCE_TYPE_LAST: { - ihit->effectMask |= effectMask; // Immune effects removed from mask - ihit->scaleAura = false; - if (m_auraScaleMask && ihit->effectMask == m_auraScaleMask && m_caster != target) + // find last added target for this effect + for (std::list::reverse_iterator ihit = m_UniqueTargetInfo.rbegin(); ihit != m_UniqueTargetInfo.rend(); ++ihit) { - SpellInfo const* auraSpell = sSpellMgr->GetSpellInfo(sSpellMgr->GetFirstSpellInChain(m_spellInfo->Id)); - if (uint32(target->getLevel() + 10) >= auraSpell->SpellLevel) - ihit->scaleAura = true; + if (ihit->effectMask & (1<targetGUID); + break; + } } - return; + break; } + default: + ASSERT(false && "Spell::SelectImplicitAreaTargets: received not implemented target reference type"); + return; } + if (!referer) + return; - // This is new target calculate data for him + Position const* center = NULL; + switch (targetType.GetReferenceType()) + { + case TARGET_REFERENCE_TYPE_SRC: + center = m_targets.GetSrc(); + break; + case TARGET_REFERENCE_TYPE_DEST: + center = m_targets.GetDst(); + break; + case TARGET_REFERENCE_TYPE_CASTER: + case TARGET_REFERENCE_TYPE_TARGET: + case TARGET_REFERENCE_TYPE_LAST: + center = referer; + break; + default: + ASSERT(false && "Spell::SelectImplicitAreaTargets: received not implemented target reference type"); + return; + } + std::list targets; + float radius = m_spellInfo->Effects[effIndex].CalcRadius(m_caster) * m_spellValue->RadiusMod; + SearchAreaTargets(targets, radius, center, referer, targetType.GetObjectType(), targetType.GetCheckType(), m_spellInfo->Effects[effIndex].ImplicitTargetConditions); - // Get spell hit result on target - TargetInfo targetInfo; - targetInfo.targetGUID = targetGUID; // Store target GUID - targetInfo.effectMask = effectMask; // Store all effects not immune - targetInfo.processed = false; // Effects not apply on target - targetInfo.alive = target->isAlive(); - targetInfo.damage = 0; - targetInfo.crit = false; - targetInfo.scaleAura = false; - if (m_auraScaleMask && targetInfo.effectMask == m_auraScaleMask && m_caster != target) + // Custom entries + // TODO: remove those + switch (m_spellInfo->Id) { - SpellInfo const* auraSpell = sSpellMgr->GetSpellInfo(sSpellMgr->GetFirstSpellInChain(m_spellInfo->Id)); - if (uint32(target->getLevel() + 10) >= auraSpell->SpellLevel) - targetInfo.scaleAura = true; - } + case 46584: // Raise Dead + { + if (Player* playerCaster = m_caster->ToPlayer()) + { + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) + { + switch ((*itr)->GetTypeId()) + { + case TYPEID_UNIT: + case TYPEID_PLAYER: + { + Unit* unitTarget = (*itr)->ToUnit(); + if (unitTarget->isAlive() || !playerCaster->isHonorOrXPTarget(unitTarget) + || ((unitTarget->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0) + || (unitTarget->GetDisplayId() != unitTarget->GetNativeDisplayId())) + break; + AddUnitTarget(unitTarget, effMask, false); + // no break; + } + case TYPEID_CORPSE: // wont work until corpses are allowed in target lists, but at least will send dest in packet + m_targets.SetDst(*(*itr)); + return; // nothing more to do here + default: + break; + } + } + } + return; // don't add targets to target map + } + // Corpse Explosion + case 49158: + case 51325: + case 51326: + case 51327: + case 51328: + // check if our target is not valid (spell can target ghoul or dead unit) + if (!(m_targets.GetUnitTarget() && m_targets.GetUnitTarget()->GetDisplayId() == m_targets.GetUnitTarget()->GetNativeDisplayId() && + ((m_targets.GetUnitTarget()->GetEntry() == 26125 && m_targets.GetUnitTarget()->GetOwnerGUID() == m_caster->GetGUID()) + || m_targets.GetUnitTarget()->isDead()))) + { + // remove existing targets + CleanupTargetList(); - // Calculate hit result - if (m_originalCaster) + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) + { + switch ((*itr)->GetTypeId()) + { + case TYPEID_UNIT: + case TYPEID_PLAYER: + if (!(*itr)->ToUnit()->isDead()) + break; + AddUnitTarget((*itr)->ToUnit(), 1 << effIndex, false); + return; + default: + break; + } + } + if (m_caster->GetTypeId() == TYPEID_PLAYER) + m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true); + SendCastResult(SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW); + finish(false); + } + return; + default: + break; + } + std::list unitTargets; + std::list gObjTargets; + // for compability with older code - add only unit and go targets + // TODO: remove this + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) { - targetInfo.missCondition = m_originalCaster->SpellHitResult(target, m_spellInfo, m_canReflect); - if (m_skipCheck && targetInfo.missCondition != SPELL_MISS_IMMUNE) - targetInfo.missCondition = SPELL_MISS_NONE; + if (Unit* unitTarget = (*itr)->ToUnit()) + unitTargets.push_back(unitTarget); + else if (GameObject* gObjTarget = (*itr)->ToGameObject()) + gObjTargets.push_back(gObjTarget); } - else - targetInfo.missCondition = SPELL_MISS_EVADE; //SPELL_MISS_NONE; - // Spell have speed - need calculate incoming time - // Incoming time is zero for self casts. At least I think so. - if (m_spellInfo->Speed > 0.0f && m_caster != target) + if (!unitTargets.empty()) { - // calculate spell incoming interval - // TODO: this is a hack - float dist = m_caster->GetDistance(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); + // Special target selection for smart heals and energizes + uint32 maxSize = 0; + int32 power = -1; + switch (m_spellInfo->SpellFamilyName) + { + case SPELLFAMILY_GENERIC: + switch (m_spellInfo->Id) + { + case 52759: // Ancestral Awakening + case 71610: // Echoes of Light (Althor's Abacus normal version) + case 71641: // Echoes of Light (Althor's Abacus heroic version) + maxSize = 1; + power = POWER_HEALTH; + break; + case 54968: // Glyph of Holy Light + maxSize = m_spellInfo->MaxAffectedTargets; + power = POWER_HEALTH; + break; + case 57669: // Replenishment + // In arenas Replenishment may only affect the caster + if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->InArena()) + { + unitTargets.clear(); + unitTargets.push_back(m_caster); + break; + } + maxSize = 10; + power = POWER_MANA; + break; + default: + break; + } + break; + case SPELLFAMILY_PRIEST: + if (m_spellInfo->SpellFamilyFlags[0] == 0x10000000) // Circle of Healing + { + maxSize = m_caster->HasAura(55675) ? 6 : 5; // Glyph of Circle of Healing + power = POWER_HEALTH; + } + else if (m_spellInfo->Id == 64844) // Divine Hymn + { + maxSize = 3; + power = POWER_HEALTH; + } + else if (m_spellInfo->Id == 64904) // Hymn of Hope + { + maxSize = 3; + power = POWER_MANA; + } + else + break; - if (dist < 5.0f) - dist = 5.0f; - targetInfo.timeDelay = (uint64) floor(dist / m_spellInfo->Speed * 1000.0f); + // Remove targets outside caster's raid + for (std::list::iterator itr = unitTargets.begin() ; itr != unitTargets.end();) + { + if (!(*itr)->IsInRaidWith(m_caster)) + itr = unitTargets.erase(itr); + else + ++itr; + } + break; + case SPELLFAMILY_DRUID: + if (m_spellInfo->SpellFamilyFlags[1] == 0x04000000) // Wild Growth + { + maxSize = m_caster->HasAura(62970) ? 6 : 5; // Glyph of Wild Growth + power = POWER_HEALTH; + } + else if (m_spellInfo->SpellFamilyFlags[2] == 0x0100) // Starfall + { + // Remove targets not in LoS or in stealth + for (std::list::iterator itr = unitTargets.begin() ; itr != unitTargets.end();) + { + if ((*itr)->HasStealthAura() || (*itr)->HasInvisibilityAura() || !(*itr)->IsWithinLOSInMap(m_caster)) + itr = unitTargets.erase(itr); + else + ++itr; + } + break; + } + else + break; - // Calculate minimum incoming time - if (m_delayMoment == 0 || m_delayMoment > targetInfo.timeDelay) - m_delayMoment = targetInfo.timeDelay; - } - else - targetInfo.timeDelay = 0LL; + // Remove targets outside caster's raid + for (std::list::iterator itr = unitTargets.begin() ; itr != unitTargets.end();) + if (!(*itr)->IsInRaidWith(m_caster)) + itr = unitTargets.erase(itr); + else + ++itr; + break; + default: + break; + } - // If target reflect spell back to caster - if (targetInfo.missCondition == SPELL_MISS_REFLECT) - { - // Calculate reflected spell result on caster - targetInfo.reflectResult = m_caster->SpellHitResult(m_caster, m_spellInfo, m_canReflect); + if (maxSize && power != -1) + { + if (Powers(power) == POWER_HEALTH) + { + if (unitTargets.size() > maxSize) + { + unitTargets.sort(Trinity::HealthPctOrderPred()); + unitTargets.resize(maxSize); + } + } + else + { + for (std::list::iterator itr = unitTargets.begin() ; itr != unitTargets.end();) + if ((*itr)->getPowerType() != (Powers)power) + itr = unitTargets.erase(itr); + else + ++itr; - if (targetInfo.reflectResult == SPELL_MISS_REFLECT) // Impossible reflect again, so simply deflect spell - targetInfo.reflectResult = SPELL_MISS_PARRY; + if (unitTargets.size() > maxSize) + { + unitTargets.sort(Trinity::PowerPctOrderPred((Powers)power)); + unitTargets.resize(maxSize); + } + } + } - // Increase time interval for reflected spells by 1.5 - targetInfo.timeDelay += targetInfo.timeDelay >> 1; + // Other special target selection goes here + if (uint32 maxTargets = m_spellValue->MaxAffectedTargets) + { + Unit::AuraEffectList const& Auras = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_MAX_AFFECTED_TARGETS); + for (Unit::AuraEffectList::const_iterator j = Auras.begin(); j != Auras.end(); ++j) + if ((*j)->IsAffectedOnSpell(m_spellInfo)) + maxTargets += (*j)->GetAmount(); + + if (m_spellInfo->Id == 5246) //Intimidating Shout + unitTargets.remove(m_targets.GetUnitTarget()); + Trinity::RandomResizeList(unitTargets, maxTargets); + } + + CallScriptAfterUnitTargetSelectHandlers(unitTargets, effIndex); + + for (std::list::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr) + AddUnitTarget(*itr, effMask, false); } - else - targetInfo.reflectResult = SPELL_MISS_NONE; - // Add target to list - m_UniqueTargetInfo.push_back(targetInfo); + if (!gObjTargets.empty()) + { + if (uint32 maxTargets = m_spellValue->MaxAffectedTargets) + { + Unit::AuraEffectList const& Auras = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_MAX_AFFECTED_TARGETS); + for (Unit::AuraEffectList::const_iterator j = Auras.begin(); j != Auras.end(); ++j) + if ((*j)->IsAffectedOnSpell(m_spellInfo)) + maxTargets += (*j)->GetAmount(); + + Trinity::RandomResizeList(gObjTargets, maxTargets); + } + for (std::list::iterator itr = gObjTargets.begin(); itr != gObjTargets.end(); ++itr) + AddGOTarget(*itr, effMask); + } } -void Spell::AddGOTarget(GameObject* go, uint32 effectMask) +void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) { - for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) + switch(targetType.GetType()) { - if (!m_spellInfo->Effects[effIndex].IsEffect()) - effectMask &= ~(1 << effIndex); - else - { - switch (m_spellInfo->Effects[effIndex].Effect) + case TARGET_DEST_CASTER: + m_targets.SetDst(*m_caster); + return; + case TARGET_DEST_HOME: + if (Player* playerCaster = m_caster->ToPlayer()) + m_targets.SetDst(playerCaster->m_homebindX, playerCaster->m_homebindY, playerCaster->m_homebindZ, playerCaster->GetOrientation(), playerCaster->m_homebindMapId); + return; + case TARGET_DEST_DB: + if (SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id)) { - case SPELL_EFFECT_GAMEOBJECT_DAMAGE: - case SPELL_EFFECT_GAMEOBJECT_REPAIR: - case SPELL_EFFECT_GAMEOBJECT_SET_DESTRUCTION_STATE: - if (go->GetGoType() != GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING) - effectMask &= ~(1 << effIndex); - break; - default: - break; + // TODO: fix this check + if (m_spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_UNITS)) + m_targets.SetDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation, (int32)st->target_mapId); + else if (st->target_mapId == m_caster->GetMapId()) + m_targets.SetDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation); + } + else + { + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id); + WorldObject* target = m_targets.GetObjectTarget(); + m_targets.SetDst(target ? *target : *m_caster); } + return; + case TARGET_DEST_CASTER_FISHING: + { + float min_dis = m_spellInfo->GetMinRange(true); + float max_dis = m_spellInfo->GetMaxRange(true); + float dis = (float)rand_norm() * (max_dis - min_dis) + min_dis; + float x, y, z, angle; + angle = (float)rand_norm() * static_cast(M_PI * 35.0f / 180.0f) - static_cast(M_PI * 17.5f / 180.0f); + m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dis, angle); + m_targets.SetDst(x, y, z, m_caster->GetOrientation()); + return; } } - if (!effectMask) - return; + float dist; + float angle = targetType.CalcDirectionAngle(); + float objSize = m_caster->GetObjectSize(); + if (targetType.GetType() == TARGET_DEST_CASTER_SUMMON) + dist = PET_FOLLOW_DIST; + else + dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster); - uint64 targetGUID = go->GetGUID(); + if (dist < objSize) + dist = objSize; + else if (targetType.GetType() == TARGET_DEST_CASTER_RANDOM) + dist = objSize + (dist - objSize) * (float)rand_norm(); - // Lookup target in already in list - for (std::list::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) + Position pos; + if (targetType.GetType() == TARGET_DEST_CASTER_FRONT_LEAP) + m_caster->GetFirstCollisionPosition(pos, dist, angle); + else + m_caster->GetNearPosition(pos, dist, angle); + m_targets.SetDst(*m_caster); + m_targets.ModDst(pos); +} + +void Spell::SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) +{ + WorldObject* target = m_targets.GetObjectTarget(); + switch(targetType.GetTarget()) { - if (targetGUID == ihit->targetGUID) // Found in list - { - ihit->effectMask |= effectMask; // Add only effect mask + case TARGET_DEST_TARGET_ENEMY: + case TARGET_DEST_TARGET_ANY: + m_targets.SetDst(*target); return; - } } - // This is new target calculate data for him + float angle = targetType.CalcDirectionAngle(); + float objSize = target->GetObjectSize(); + float dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster); + if (dist < objSize) + dist = objSize; + else if (targetType.GetType() == TARGET_DEST_TARGET_RANDOM) + dist = objSize + (dist - objSize) * (float)rand_norm(); - GOTargetInfo target; - target.targetGUID = targetGUID; - target.effectMask = effectMask; - target.processed = false; // Effects not apply on target + Position pos; + target->GetNearPosition(pos, dist, angle); + m_targets.SetDst(*target); + m_targets.ModDst(pos); +} - // Spell have speed - need calculate incoming time - if (m_spellInfo->Speed > 0.0f) +void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) +{ + switch(targetType.GetTarget()) { - // calculate spell incoming interval - float dist = m_caster->GetDistance(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ()); - if (dist < 5.0f) - dist = 5.0f; - target.timeDelay = uint64(floor(dist / m_spellInfo->Speed * 1000.0f)); - if (m_delayMoment == 0 || m_delayMoment > target.timeDelay) - m_delayMoment = target.timeDelay; + case TARGET_DEST_DYNOBJ_ENEMY: + case TARGET_DEST_DYNOBJ_ALLY: + case TARGET_DEST_DYNOBJ_NONE: + case TARGET_DEST_DEST: + return; + case TARGET_DEST_TRAJ: + SelectImplicitTrajTargets(); + return; } - else - target.timeDelay = 0LL; - // Add target to list - m_UniqueGOTargetInfo.push_back(target); + float angle = targetType.CalcDirectionAngle(); + float dist = m_spellInfo->Effects[effIndex].CalcRadius(m_caster); + if (targetType.GetTarget() == TARGET_DEST_DEST_RANDOM) + dist *= (float)rand_norm(); + + Position pos = *m_targets.GetDst(); + m_caster->MovePosition(pos, dist, angle); + m_targets.ModDst(pos); } -void Spell::AddGOTarget(uint64 goGUID, uint32 effectMask) +void Spell::SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) { - if (GameObject* go = m_caster->GetMap()->GetGameObject(goGUID)) - AddGOTarget(go, effectMask); + switch(targetType.GetTarget()) + { + case TARGET_UNIT_CASTER: + AddUnitTarget(m_caster, 1 << effIndex, false); + break; + case TARGET_UNIT_MASTER: + if (Unit* owner = m_caster->GetCharmerOrOwner()) + AddUnitTarget(owner, 1 << effIndex); + break; + case TARGET_UNIT_PET: + if (Guardian* pet = m_caster->GetGuardianPet()) + AddUnitTarget(pet, 1 << effIndex); + break; + case TARGET_UNIT_SUMMONER: + if (m_caster->isSummon()) + if (Unit* unit = m_caster->ToTempSummon()->GetSummoner()) + AddUnitTarget(unit, 1 << effIndex); + break; + case TARGET_UNIT_VEHICLE: + if (Unit *vehicle = m_caster->GetVehicleBase()) + AddUnitTarget(vehicle, 1 << effIndex); + break; + case TARGET_UNIT_PASSENGER_0: + case TARGET_UNIT_PASSENGER_1: + case TARGET_UNIT_PASSENGER_2: + case TARGET_UNIT_PASSENGER_3: + case TARGET_UNIT_PASSENGER_4: + case TARGET_UNIT_PASSENGER_5: + case TARGET_UNIT_PASSENGER_6: + case TARGET_UNIT_PASSENGER_7: + if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsVehicle()) + if (Unit *unit = m_caster->GetVehicleKit()->GetPassenger(targetType.GetTarget() - TARGET_UNIT_PASSENGER_0)) + AddUnitTarget(unit, 1 << effIndex); + break; + } } -void Spell::AddItemTarget(Item* item, uint32 effectMask) +void Spell::SelectImplicitTargetObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) { - for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) - if (!m_spellInfo->Effects[effIndex].IsEffect()) - effectMask &= ~(1 << effIndex); + ASSERT(m_targets.GetObjectTarget() && "Spell::SelectImplicitTargetObjectTargets - no explicit object target available!"); + if (Unit* unit = m_targets.GetUnitTarget()) + AddUnitTarget(unit, 1 << effIndex); + else if (GameObject* gobj = m_targets.GetGOTarget()) + AddGOTarget(gobj, 1 << effIndex); + else + AddItemTarget(m_targets.GetItemTarget(), effIndex); - // no effects left - if (!effectMask) - return; + if (WorldObject* target = m_targets.GetObjectTarget()) + SelectImplicitChainTargets(effIndex, targetType, target, 1 << effIndex); +} - // Lookup target in already in list - for (std::list::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) +void Spell::SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, WorldObject* target, uint32 effMask) +{ + uint32 maxTargets = m_spellInfo->Effects[effIndex].ChainTarget; + if (Player* modOwner = m_caster->GetSpellModOwner()) + modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, maxTargets, this); + + if (maxTargets > 1) { - if (item == ihit->item) // Found in list - { - ihit->effectMask |= effectMask; // Add only effect mask - return; - } - } + // mark damage multipliers as used + for (uint32 k = effIndex; k < MAX_SPELL_EFFECTS; ++k) + if (effMask & (1 << k)) + m_damageMultipliers[k] = 1.0f; + m_applyMultiplierMask |= effMask; - // This is new target add data + std::list targets; + SearchChainTargets(targets, maxTargets - 1, target, targetType.GetObjectType(), targetType.GetCheckType() + , m_spellInfo->Effects[effIndex].ImplicitTargetConditions, targetType.GetType() == TARGET_UNIT_TARGET_CHAINHEAL_ALLY); - ItemTargetInfo target; - target.item = item; - target.effectMask = effectMask; + // for backward compability + std::list unitTargets; + for (std::list::iterator itr = targets.begin(); itr != targets.end(); ++itr) + if (Unit* unitTarget = (*itr)->ToUnit()) + unitTargets.push_back(unitTarget); - m_UniqueItemInfo.push_back(target); + CallScriptAfterUnitTargetSelectHandlers(unitTargets, effIndex); + + for (std::list::iterator itr = unitTargets.begin(); itr != unitTargets.end(); ++itr) + AddUnitTarget(*itr, effMask, false); + } } -void Spell::DoAllEffectOnTarget(TargetInfo* target) +float tangent(float x) { - if (!target || target->processed) - return; - - target->processed = true; // Target checked in apply effects procedure - - // Get mask of effects for target - uint8 mask = target->effectMask; - - Unit* unit = m_caster->GetGUID() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target->targetGUID); - if (!unit) - { - uint8 farMask = 0; - // create far target mask - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (m_spellInfo->Effects[i].IsFarUnitTargetEffect()) - if ((1 << i) & mask) - farMask |= (1 << i); + x = tan(x); + //if (x < std::numeric_limits::max() && x > -std::numeric_limits::max()) return x; + //if (x >= std::numeric_limits::max()) return std::numeric_limits::max(); + //if (x <= -std::numeric_limits::max()) return -std::numeric_limits::max(); + if (x < 100000.0f && x > -100000.0f) return x; + if (x >= 100000.0f) return 100000.0f; + if (x <= 100000.0f) return -100000.0f; + return 0.0f; +} - if (!farMask) - return; - // find unit in world - unit = ObjectAccessor::FindUnit(target->targetGUID); - if (!unit) - return; +#define DEBUG_TRAJ(a) //a - // do far effects on the unit - // can't use default call because of threading, do stuff as fast as possible - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (farMask & (1 << i)) - HandleEffects(unit, NULL, NULL, i, SPELL_EFFECT_HANDLE_HIT_TARGET); +void Spell::SelectImplicitTrajTargets() +{ + if (!m_targets.HasTraj()) return; - } - if (unit->isAlive() != target->alive) + float dist2d = m_targets.GetDist2d(); + if (!dist2d) return; - if (getState() == SPELL_STATE_DELAYED && !m_spellInfo->IsPositive() && (getMSTime() - target->timeDelay) <= unit->m_lastSanctuaryTime) - return; // No missinfo in that case - - // Get original caster (if exist) and calculate damage/healing from him data - Unit* caster = m_originalCaster ? m_originalCaster : m_caster; + float srcToDestDelta = m_targets.GetDst()->m_positionZ - m_targets.GetSrc()->m_positionZ; - // Skip if m_originalCaster not avaiable - if (!caster) + std::list targets; + Trinity::WorldObjectSpellTrajTargetCheck check(dist2d, m_targets.GetSrc(), m_caster, m_spellInfo); + Trinity::WorldObjectListSearcher searcher(m_caster, targets, check, GRID_MAP_TYPE_MASK_ALL); + SearchTargets > (searcher, GRID_MAP_TYPE_MASK_ALL, m_caster, m_targets.GetSrc(), dist2d); + if (targets.empty()) return; - SpellMissInfo missInfo = target->missCondition; - - // Need init unitTarget by default unit (can changed in code on reflect) - // Or on missInfo != SPELL_MISS_NONE unitTarget undefined (but need in trigger subsystem) - unitTarget = unit; - - // Reset damage/healing counter - m_damage = target->damage; - m_healing = -target->damage; - - // Fill base trigger info - uint32 procAttacker = m_procAttacker; - uint32 procVictim = m_procVictim; - uint32 procEx = m_procEx; + targets.sort(Trinity::ObjectDistanceOrderPred(m_caster)); - m_spellAura = NULL; // Set aura to null for every target-make sure that pointer is not used for unit without aura applied + float b = tangent(m_targets.GetElevation()); + float a = (srcToDestDelta - dist2d * b) / (dist2d * dist2d); + if (a > -0.0001f) + a = 0; + DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: a %f b %f", a, b);) - //Spells with this flag cannot trigger if effect is casted on self - bool canEffectTrigger = !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_CANT_TRIGGER_PROC) && unitTarget->CanProc() && CanExecuteTriggersOnHit(mask); - Unit* spellHitTarget = NULL; + float bestDist = m_spellInfo->GetMaxRange(false); - if (missInfo == SPELL_MISS_NONE) // In case spell hit target, do all effect on that target - spellHitTarget = unit; - else if (missInfo == SPELL_MISS_REFLECT) // In case spell reflect from target, do all effect on caster (if hit) + std::list::const_iterator itr = targets.begin(); + for (; itr != targets.end(); ++itr) { - if (target->reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him - { - spellHitTarget = m_caster; - if (m_caster->GetTypeId() == TYPEID_UNIT) - m_caster->ToCreature()->LowerPlayerDamageReq(target->damage); - } - } + if (Unit* unitTarget = (*itr)->ToUnit()) + if (m_caster == *itr || m_caster->IsOnVehicle(unitTarget) || (unitTarget)->GetVehicle())//(*itr)->IsOnVehicle(m_caster)) + continue; - if (spellHitTarget) - { - SpellMissInfo missInfo2 = DoSpellHitOnUnit(spellHitTarget, mask, target->scaleAura); - if (missInfo2 != SPELL_MISS_NONE) - { - if (missInfo2 != SPELL_MISS_MISS) - m_caster->SendSpellMiss(unit, m_spellInfo->Id, missInfo2); - m_damage = 0; - spellHitTarget = NULL; - } - } + const float size = std::max((*itr)->GetObjectSize() * 0.7f, 1.0f); // 1/sqrt(3) + // TODO: all calculation should be based on src instead of m_caster + const float objDist2d = m_targets.GetSrc()->GetExactDist2d(*itr) * cos(m_targets.GetSrc()->GetRelativeAngle(*itr)); + const float dz = (*itr)->GetPositionZ() - m_targets.GetSrc()->m_positionZ; - // Do not take combo points on dodge and miss - if (missInfo != SPELL_MISS_NONE && m_needComboPoints && - m_targets.GetUnitTargetGUID() == target->targetGUID) - { - m_needComboPoints = false; - // Restore spell mods for a miss/dodge/parry Cold Blood - // TODO: check how broad this rule should be - if (m_caster->GetTypeId() == TYPEID_PLAYER && (missInfo == SPELL_MISS_MISS || - missInfo == SPELL_MISS_DODGE || missInfo == SPELL_MISS_PARRY)) - m_caster->ToPlayer()->RestoreSpellMods(this, 14177); - } + DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);) - // Trigger info was not filled in spell::preparedatafortriggersystem - we do it now - if (canEffectTrigger && !procAttacker && !procVictim) - { - bool positive = true; - if (m_damage > 0) - positive = false; - else if (!m_healing) - { - for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i) - // If at least one effect negative spell is negative hit - if (mask & (1<IsPositiveEffect(i)) - { - positive = false; - break; - } - } - switch (m_spellInfo->DmgClass) + float dist = objDist2d - size; + float height = dist * (a * dist + b); + DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);) + if (dist < bestDist && height < dz + size && height > dz - size) { - case SPELL_DAMAGE_CLASS_MAGIC: - if (positive) - { - procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS; - procVictim |= PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS; - } - else - { - procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG; - procVictim |= PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG; - } - break; - case SPELL_DAMAGE_CLASS_NONE: - if (positive) - { - procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS; - procVictim |= PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS; - } - else - { - procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG; - procVictim |= PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG; - } + bestDist = dist > 0 ? dist : 0; break; } - } - CallScriptOnHitHandlers(); - // All calculated do it! - // Do healing and triggers - if (m_healing > 0) - { - bool crit = caster->isSpellCrit(unitTarget, m_spellInfo, m_spellSchoolMask); - uint32 addhealth = m_healing; - if (crit) - { - procEx |= PROC_EX_CRITICAL_HIT; - addhealth = caster->SpellCriticalHealingBonus(m_spellInfo, addhealth, NULL); +#define CHECK_DIST {\ + DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\ + if (dist > bestDist)\ + continue;\ + if (dist < objDist2d + size && dist > objDist2d - size)\ + {\ + bestDist = dist;\ + break;\ + }\ } - else - procEx |= PROC_EX_NORMAL_HIT; - - // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) - if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT) - caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo, m_triggeredByAuraSpell); - int32 gain = caster->HealBySpell(unitTarget, m_spellInfo, addhealth, crit); - unitTarget->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo); - m_healing = gain; - } - // Do damage and triggers - else if (m_damage > 0) - { - // Fill base damage struct (unitTarget - is real spell target) - SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask); - - // Add bonuses and fill damageInfo struct - caster->CalculateSpellDamageTaken(&damageInfo, m_damage, m_spellInfo, m_attackType, target->crit); - caster->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); + if (!a) + { + height = dz - size; + dist = height / b; + CHECK_DIST; - // Send log damage message to client - caster->SendSpellNonMeleeDamageLog(&damageInfo); + height = dz + size; + dist = height / b; + CHECK_DIST; - procEx |= createProcExtendMask(&damageInfo, missInfo); - procVictim |= PROC_FLAG_TAKEN_DAMAGE; + continue; + } - // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) - if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT) + height = dz - size; + float sqrt1 = b * b + 4 * a * height; + if (sqrt1 > 0) { - caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo, m_triggeredByAuraSpell); - if (caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->Attributes & SPELL_ATTR0_STOP_ATTACK_TARGET) == 0 && - (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)) - caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx); + sqrt1 = sqrt(sqrt1); + dist = (sqrt1 - b) / (2 * a); + CHECK_DIST; } - caster->DealSpellDamage(&damageInfo, true); - - // Haunt - if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[1] & 0x40000 && m_spellAura && m_spellAura->GetEffect(1)) + height = dz + size; + float sqrt2 = b * b + 4 * a * height; + if (sqrt2 > 0) { - AuraEffect* aurEff = m_spellAura->GetEffect(1); - aurEff->SetAmount(CalculatePctU(aurEff->GetAmount(), damageInfo.damage)); + sqrt2 = sqrt(sqrt2); + dist = (sqrt2 - b) / (2 * a); + CHECK_DIST; + + dist = (-sqrt2 - b) / (2 * a); + CHECK_DIST; } - m_damage = damageInfo.damage; - } - // Passive spell hits/misses or active spells only misses (only triggers) - else - { - // Fill base damage struct (unitTarget - is real spell target) - SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask); - procEx |= createProcExtendMask(&damageInfo, missInfo); - // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) - if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT) - caster->ProcDamageAndSpell(unit, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo, m_triggeredByAuraSpell); - // Failed Pickpocket, reveal rogue - if (missInfo == SPELL_MISS_RESIST && m_spellInfo->AttributesCu & SPELL_ATTR0_CU_PICKPOCKET && unitTarget->GetTypeId() == TYPEID_UNIT) + if (sqrt1 > 0) { - m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK); - if (unitTarget->ToCreature()->IsAIEnabled) - unitTarget->ToCreature()->AI()->AttackStart(m_caster); + dist = (-sqrt1 - b) / (2 * a); + CHECK_DIST; } } - if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && !m_spellInfo->IsPositive()) + if (m_targets.GetSrc()->GetExactDist2d(m_targets.GetDst()) > bestDist) { - m_caster->CombatStart(unit, !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO)); + float x = m_targets.GetSrc()->m_positionX + cos(m_caster->GetOrientation()) * bestDist; + float y = m_targets.GetSrc()->m_positionY + sin(m_caster->GetOrientation()) * bestDist; + float z = m_targets.GetSrc()->m_positionZ + bestDist * (a * bestDist + b); - if (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_AURA_CC) - if (!unit->IsStandState()) - unit->SetStandState(UNIT_STAND_STATE_STAND); - } - - if (spellHitTarget) - { - //AI functions - if (spellHitTarget->GetTypeId() == TYPEID_UNIT) + if (itr != targets.end()) { - if (spellHitTarget->ToCreature()->IsAIEnabled) - spellHitTarget->ToCreature()->AI()->SpellHit(m_caster, m_spellInfo); + float distSq = (*itr)->GetExactDistSq(x, y, z); + float sizeSq = (*itr)->GetObjectSize(); + sizeSq *= sizeSq; + DEBUG_TRAJ(sLog->outError("Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) + if (distSq > sizeSq) + { + float factor = 1 - sqrt(sizeSq / distSq); + x += factor * ((*itr)->GetPositionX() - x); + y += factor * ((*itr)->GetPositionY() - y); + z += factor * ((*itr)->GetPositionZ() - z); - // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) - // ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm...) - if (m_originalCaster && m_originalCaster->IsControlledByPlayer() && !spellHitTarget->ToCreature()->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive()) - if (Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself()) - p->CastedCreatureOrGO(spellHitTarget->GetEntry(), spellHitTarget->GetGUID(), m_spellInfo->Id); + distSq = (*itr)->GetExactDistSq(x, y, z); + DEBUG_TRAJ(sLog->outError("Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) + } } - if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsAIEnabled) - m_caster->ToCreature()->AI()->SpellHitTarget(spellHitTarget, m_spellInfo); - - // Needs to be called after dealing damage/healing to not remove breaking on damage auras - DoTriggersOnSpellHit(spellHitTarget, mask); - - // if target is fallged for pvp also flag caster if a player - if (unit->IsPvP() && m_caster->GetTypeId() == TYPEID_PLAYER) - m_caster->ToPlayer()->UpdatePvP(true); - - CallScriptAfterHitHandlers(); + Position trajDst; + trajDst.Relocate(x, y, z, m_caster->GetOrientation()); + m_targets.ModDst(trajDst); } } -SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleAura) +void Spell::SelectEffectTypeImplicitTargets(uint8 effIndex) { - if (!unit || !effectMask) - return SPELL_MISS_EVADE; + // special case for SPELL_EFFECT_SUMMON_RAF_FRIEND and SPELL_EFFECT_SUMMON_PLAYER + // TODO: this is a workaround - target shouldn't be stored in target map for those spells + switch (m_spellInfo->Effects[effIndex].Effect) + { + case SPELL_EFFECT_SUMMON_RAF_FRIEND: + case SPELL_EFFECT_SUMMON_PLAYER: + if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->GetSelection()) + { + Player* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetSelection()); + if (target) + AddUnitTarget(target, 1 << effIndex, false); + } + return; + default: + break; + } - // For delayed spells immunity may be applied between missile launch and hit - check immunity for that case - // disable effects to which unit is immune - for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber) - if (effectMask & (1 << effectNumber) && unit->IsImmunedToSpellEffect(m_spellInfo, effectNumber)) - effectMask &= ~(1 << effectNumber); - if (!effectMask || (m_spellInfo->Speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo)))) - return SPELL_MISS_IMMUNE; + // select spell implicit targets based on effect type + if (!m_spellInfo->Effects[effIndex].GetImplicitTargetType()) + return; - PrepareScriptHitHandlers(); - CallScriptBeforeHitHandlers(); + uint32 targetMask = m_spellInfo->Effects[effIndex].GetMissingTargetMask(); - if (unit->GetTypeId() == TYPEID_PLAYER) + if (!targetMask) + return; + + switch (m_spellInfo->Effects[effIndex].GetImplicitTargetType()) { - unit->ToPlayer()->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, m_spellInfo->Id); - unit->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, m_spellInfo->Id, 0, m_caster); - unit->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, m_spellInfo->Id); + // add explicit object target or self to the target map + case EFFECT_IMPLICIT_TARGET_EXPLICIT: + // player which not released his spirit is Unit, but target flag for it is TARGET_FLAG_CORPSE_MASK + if (targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK)) + { + if (Unit* unitTarget = m_targets.GetUnitTarget()) + AddUnitTarget(unitTarget, 1 << effIndex, false); + else if (targetMask & TARGET_FLAG_CORPSE_MASK) + { + if (Corpse* corpseTarget = m_targets.GetCorpseTarget()) + { + // TODO: this is a workaround - corpses should be added to spell target map too, but we can't do that so we add owner instead + if (Player* owner = ObjectAccessor::FindPlayer(corpseTarget->GetOwnerGUID())) + AddUnitTarget(owner, 1 << effIndex, false); + } + } + else //if (targetMask & TARGET_FLAG_UNIT_MASK) + { + AddUnitTarget(m_caster, 1 << effIndex, false); + } + } + if (targetMask & TARGET_FLAG_ITEM_MASK) + { + if (Item* itemTarget = m_targets.GetItemTarget()) + AddItemTarget(itemTarget, 1 << effIndex); + } + if (targetMask & TARGET_FLAG_GAMEOBJECT_MASK) + { + if (GameObject* gObjTarget = m_targets.GetGOTarget()) + AddGOTarget(gObjTarget, 1 << effIndex); + } + break; + // add self to the target map + case EFFECT_IMPLICIT_TARGET_CASTER: + if (targetMask & TARGET_FLAG_UNIT_MASK) + AddUnitTarget(m_caster, 1 << effIndex, false); + break; + default: + break; } +} - if (m_caster->GetTypeId() == TYPEID_PLAYER) +uint32 Spell::GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionList* condList) +{ + // this function selects which containers need to be searched for spell target + uint32 retMask = GRID_MAP_TYPE_MASK_ALL; + + // filter searchers based on searched object type + switch (objType) { - m_caster->ToPlayer()->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_CASTER, m_spellInfo->Id); - m_caster->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, m_spellInfo->Id, 0, unit); + case TARGET_OBJECT_TYPE_UNIT: + case TARGET_OBJECT_TYPE_UNIT_AND_DEST: + case TARGET_OBJECT_TYPE_CORPSE: + case TARGET_OBJECT_TYPE_CORPSE_ENEMY: + case TARGET_OBJECT_TYPE_CORPSE_ALLY: + retMask &= GRID_MAP_TYPE_MASK_PLAYER | GRID_MAP_TYPE_MASK_CORPSE | GRID_MAP_TYPE_MASK_CREATURE; + break; + case TARGET_OBJECT_TYPE_GOBJ: + case TARGET_OBJECT_TYPE_GOBJ_ITEM: + retMask &= GRID_MAP_TYPE_MASK_GAMEOBJECT; + break; } + if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_DEAD)) + retMask &= ~GRID_MAP_TYPE_MASK_CORPSE; + if (m_spellInfo->AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_PLAYERS) + retMask &= GRID_MAP_TYPE_MASK_CORPSE | GRID_MAP_TYPE_MASK_PLAYER; + if (m_spellInfo->AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS) + retMask &= GRID_MAP_TYPE_MASK_PLAYER; - if (m_caster != unit) + if (condList) + retMask &= sConditionMgr->GetSearcherTypeMaskForConditionList(*condList); + return retMask; +} + +template +void Spell::SearchTargets(SEARCHER& searcher, uint32 containerMask, Unit* referer, Position const* pos, float radius) +{ + if (!containerMask) + return; + + // search world and grid for possible targets + bool searchInGrid = containerMask & (GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_GAMEOBJECT); + bool searchInWorld = containerMask & (GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER | GRID_MAP_TYPE_MASK_CORPSE); + if (searchInGrid || searchInWorld) { - // Recheck UNIT_FLAG_NON_ATTACKABLE for delayed spells - if (m_spellInfo->Speed > 0.0f && unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID()) - return SPELL_MISS_EVADE; + float x,y; + x = pos->GetPositionX(); + y = pos->GetPositionY(); - if (m_caster->_IsValidAttackTarget(unit, m_spellInfo)) + CellCoord p(Trinity::ComputeCellCoord(x, y)); + Cell cell(p); + cell.SetNoCreate(); + + Map& map = *(referer->GetMap()); + + if (searchInWorld) { - unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL); - //TODO: This is a hack. But we do not know what types of stealth should be interrupted by CC - if ((m_spellInfo->AttributesCu & SPELL_ATTR0_CU_AURA_CC) && unit->IsControlledByPlayer()) - unit->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); + TypeContainerVisitor world_object_notifier(searcher); + cell.Visit(p, world_object_notifier, map, radius, x, y); } - else if (m_caster->IsFriendlyTo(unit)) + if (searchInGrid) { - // for delayed spells ignore negative spells (after duel end) for friendly targets - // TODO: this cause soul transfer bugged - if (m_spellInfo->Speed > 0.0f && unit->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->IsPositive()) - return SPELL_MISS_EVADE; - - // assisting case, healing and resurrection - if (unit->HasUnitState(UNIT_STATE_ATTACK_PLAYER)) - { - m_caster->SetContestedPvP(); - if (m_caster->GetTypeId() == TYPEID_PLAYER) - m_caster->ToPlayer()->UpdatePvP(true); - } - if (unit->isInCombat() && !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO)) - { - m_caster->SetInCombatState(unit->GetCombatTimer() > 0, unit); - unit->getHostileRefManager().threatAssist(m_caster, 0.0f); - } + TypeContainerVisitor grid_object_notifier(searcher); + cell.Visit(p, grid_object_notifier, map, radius, x , y); } } +} - // Get Data Needed for Diminishing Returns, some effects may have multiple auras, so this must be done on spell hit, not aura add - m_diminishGroup = GetDiminishingReturnsGroupForSpell(m_spellInfo, m_triggeredByAuraSpell); - if (m_diminishGroup) +WorldObject* Spell::SearchNearbyTarget(float range, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList) +{ + WorldObject* target = NULL; + uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList); + if (!containerTypeMask) + return NULL; + Trinity::WorldObjectSpellNearbyTargetCheck check(range, m_caster, m_spellInfo, selectionType, condList); + Trinity::WorldObjectLastSearcher searcher(m_caster, target, check, containerTypeMask); + SearchTargets > (searcher, containerTypeMask, m_caster, m_caster, range); + return target; +} + +void Spell::SearchAreaTargets(std::list& targets, float range, Position const* position, Unit* referer, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList) +{ + uint32 containerTypeMask = GetSearcherTypeMask(objectType, condList); + if (!containerTypeMask) + return; + Trinity::WorldObjectSpellAreaTargetCheck check(range, position, m_caster, referer, m_spellInfo, selectionType, condList); + Trinity::WorldObjectListSearcher searcher(m_caster, targets, check, containerTypeMask); + SearchTargets > (searcher, containerTypeMask, m_caster, m_caster, range); +} + +void Spell::SearchChainTargets(std::list& targets, uint32 chainTargets, WorldObject* target, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectType, ConditionList* condList, bool isChainHeal) +{ + // max dist for jump target selection + float jumpRadius = 0.0f; + switch (m_spellInfo->DmgClass) { - m_diminishLevel = unit->GetDiminishing(m_diminishGroup); - DiminishingReturnsType type = GetDiminishingReturnsGroupType(m_diminishGroup); - // Increase Diminishing on unit, current informations for actually casts will use values above - if ((type == DRTYPE_PLAYER && unit->GetCharmerOrOwnerPlayerOrPlayerItself()) || type == DRTYPE_ALL) - unit->IncrDiminishing(m_diminishGroup); + case SPELL_DAMAGE_CLASS_RANGED: + // 7.5y for multi shot + jumpRadius = 7.5f; + break; + case SPELL_DAMAGE_CLASS_MELEE: + // 5y for swipe, cleave and similar + jumpRadius = 5.0f; + break; + case SPELL_DAMAGE_CLASS_NONE: + case SPELL_DAMAGE_CLASS_MAGIC: + // 12.5y for chain heal spell since 3.2 patch + if (isChainHeal) + jumpRadius = 12.5f; + // 10y as default for magic chain spells + else + jumpRadius = 10.0f; + break; } - uint8 aura_effmask = 0; - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (effectMask & (1 << i) && m_spellInfo->Effects[i].IsUnitOwnedAuraEffect()) - aura_effmask |= 1 << i; + // chain lightning/heal spells and similar - allow to jump at larger distance and go out of los + bool isBouncingFar = (m_spellInfo->AttributesEx4 & SPELL_ATTR4_AREA_TARGET_CHAIN + || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE + || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC); - if (aura_effmask) + // max dist which spell can reach + float searchRadius = jumpRadius; + if (isBouncingFar) + searchRadius *= chainTargets; + + std::list tempTargets; + SearchAreaTargets(tempTargets, searchRadius, target, m_caster, objectType, selectType, condList); + tempTargets.remove(target); + + // remove targets which are always invalid for chain spells + // for some spells allow only chain targets in front of caster (swipe for example) + if (!isBouncingFar) { - // Select rank for aura with level requirements only in specific cases - // Unit has to be target only of aura effect, both caster and target have to be players, target has to be other than unit target - SpellInfo const* aurSpellInfo = m_spellInfo; - int32 basePoints[3]; - if (scaleAura) + for (std::list::iterator itr = tempTargets.begin(); itr != tempTargets.end();) { - aurSpellInfo = m_spellInfo->GetAuraRankForLevel(unitTarget->getLevel()); - ASSERT(aurSpellInfo); - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + std::list::iterator checkItr = itr++; + if (!m_caster->HasInArc(static_cast(M_PI), *checkItr)) + tempTargets.erase(checkItr); + } + } + + while (chainTargets) + { + // try to get unit for next chain jump + std::list::iterator foundItr = tempTargets.end(); + // get unit with highest hp deficit in dist + if (isChainHeal) + { + uint32 maxHPDeficit = 0; + for (std::list::iterator itr = tempTargets.begin(); itr != tempTargets.end(); ++itr) { - basePoints[i] = aurSpellInfo->Effects[i].BasePoints; - if (m_spellInfo->Effects[i].Effect != aurSpellInfo->Effects[i].Effect) + if (Unit* unitTarget = (*itr)->ToUnit()) { - aurSpellInfo = m_spellInfo; - break; + uint32 deficit = unitTarget->GetMaxHealth() - unitTarget->GetHealth(); + if ((deficit > maxHPDeficit || foundItr == tempTargets.end()) && target->IsWithinDist(unitTarget, jumpRadius) && target->IsWithinLOSInMap(unitTarget)) + { + foundItr = itr; + maxHPDeficit = deficit; + } } } } - - if (m_originalCaster) + // get closest object + else { - bool refresh = false; - m_spellAura = Aura::TryRefreshStackOrCreate(aurSpellInfo, effectMask, unit, - m_originalCaster, (aurSpellInfo == m_spellInfo)? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem, 0, &refresh); - if (m_spellAura) + for (std::list::iterator itr = tempTargets.begin(); itr != tempTargets.end(); ++itr) { - // Set aura stack amount to desired value - if (m_spellValue->AuraStackAmount > 1) + if (foundItr == tempTargets.end()) { - if (!refresh) - m_spellAura->SetStackAmount(m_spellValue->AuraStackAmount); - else - m_spellAura->ModStackAmount(m_spellValue->AuraStackAmount); + if ((!isBouncingFar || target->IsWithinDist(*itr, jumpRadius)) && target->IsWithinLOSInMap(*itr)) + foundItr = itr; } + else if (target->GetDistanceOrder(*itr, *foundItr) && target->IsWithinLOSInMap(*itr)) + foundItr = itr; + } + } + // not found any valid target - chain ends + if (foundItr == tempTargets.end()) + break; + target = *foundItr; + tempTargets.erase(foundItr); + targets.push_back(target); + --chainTargets; + } +} - // Now Reduce spell duration using data received at spell hit - int32 duration = m_spellAura->GetMaxDuration(); - int32 limitduration = GetDiminishingReturnsLimitDuration(m_diminishGroup, aurSpellInfo); - float diminishMod = unit->ApplyDiminishingToDuration(m_diminishGroup, duration, m_originalCaster, m_diminishLevel, limitduration); +void Spell::prepareDataForTriggerSystem(AuraEffect const* /*triggeredByAura*/) +{ + //========================================================================================== + // Now fill data for trigger system, need know: + // can spell trigger another or not (m_canTrigger) + // Create base triggers flags for Attacker and Victim (m_procAttacker, m_procVictim and m_procEx) + //========================================================================================== - // unit is immune to aura if it was diminished to 0 duration - if (diminishMod == 0.0f) - { - m_spellAura->Remove(); - bool found = false; - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (effectMask & (1 << i) && m_spellInfo->Effects[i].Effect != SPELL_EFFECT_APPLY_AURA) - found = true; - if (!found) - return SPELL_MISS_IMMUNE; - } - else - { - ((UnitAura*)m_spellAura)->SetDiminishGroup(m_diminishGroup); + m_procVictim = m_procAttacker = 0; + // Get data for type of attack and fill base info for trigger + switch (m_spellInfo->DmgClass) + { + case SPELL_DAMAGE_CLASS_MELEE: + m_procAttacker = PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS; + if (m_attackType == OFF_ATTACK) + m_procAttacker |= PROC_FLAG_DONE_OFFHAND_ATTACK; + else + m_procAttacker |= PROC_FLAG_DONE_MAINHAND_ATTACK; + m_procVictim = PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS; + break; + case SPELL_DAMAGE_CLASS_RANGED: + // Auto attack + if (m_spellInfo->AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG) + { + m_procAttacker = PROC_FLAG_DONE_RANGED_AUTO_ATTACK; + m_procVictim = PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK; + } + else // Ranged spell attack + { + m_procAttacker = PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS; + m_procVictim = PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS; + } + break; + default: + if (m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && + m_spellInfo->EquippedItemSubClassMask & (1<AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG) // Wands auto attack + { + m_procAttacker = PROC_FLAG_DONE_RANGED_AUTO_ATTACK; + m_procVictim = PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK; + } + // For other spells trigger procflags are set in Spell::DoAllEffectOnTarget + // Because spell positivity is dependant on target + } + m_procEx = PROC_EX_NONE; - bool positive = m_spellAura->GetSpellInfo()->IsPositive(); - if (AuraApplication* aurApp = m_spellAura->GetApplicationOfTarget(m_originalCaster->GetGUID())) - positive = aurApp->IsPositive(); + // Hunter trap spells - activation proc for Lock and Load, Entrapment and Misdirection + if (m_spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && + (m_spellInfo->SpellFamilyFlags[0] & 0x18 || // Freezing and Frost Trap, Freezing Arrow + m_spellInfo->Id == 57879 || // Snake Trap - done this way to avoid double proc + m_spellInfo->SpellFamilyFlags[2] & 0x00024000)) // Explosive and Immolation Trap - duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive, effectMask); + m_procAttacker |= PROC_FLAG_DONE_TRAP_ACTIVATION; - // Haste modifies duration of channeled spells - if (m_spellInfo->IsChanneled()) - { - if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION) - m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this); - } - // and duration of auras affected by SPELL_AURA_PERIODIC_HASTE - else if (m_originalCaster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, aurSpellInfo) || m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION) - duration = int32(duration * m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED)); + /* Effects which are result of aura proc from triggered spell cannot proc + to prevent chain proc of these spells */ - if (duration != m_spellAura->GetMaxDuration()) - { - m_spellAura->SetMaxDuration(duration); - m_spellAura->SetDuration(duration); - } - m_spellAura->_RegisterForTargets(); - } - } - } + // Hellfire Effect - trigger as DOT + if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[0] & 0x00000040) + { + m_procAttacker = PROC_FLAG_DONE_PERIODIC; + m_procVictim = PROC_FLAG_TAKEN_PERIODIC; } - for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber) - if (effectMask & (1 << effectNumber)) - HandleEffects(unit, NULL, NULL, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET); + // Ranged autorepeat attack is set as triggered spell - ignore it + if (!(m_procAttacker & PROC_FLAG_DONE_RANGED_AUTO_ATTACK)) + { + if (_triggeredCastFlags & TRIGGERED_DISALLOW_PROC_EVENTS && + (m_spellInfo->AttributesEx2 & SPELL_ATTR2_TRIGGERED_CAN_TRIGGER_PROC || + m_spellInfo->AttributesEx3 & SPELL_ATTR3_TRIGGERED_CAN_TRIGGER_PROC_2)) + m_procEx |= PROC_EX_INTERNAL_CANT_PROC; + else if (_triggeredCastFlags & TRIGGERED_DISALLOW_PROC_EVENTS) + m_procEx |= PROC_EX_INTERNAL_TRIGGERED; + } + // Totem casts require spellfamilymask defined in spell_proc_event to proc + if (m_originalCaster && m_caster != m_originalCaster && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isTotem() && m_caster->IsControlledByPlayer()) + m_procEx |= PROC_EX_INTERNAL_REQ_FAMILY; +} - return SPELL_MISS_NONE; +void Spell::CleanupTargetList() +{ + m_UniqueTargetInfo.clear(); + m_UniqueGOTargetInfo.clear(); + m_UniqueItemInfo.clear(); + m_delayMoment = 0; } -void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask) +void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= true*/) { - // Apply additional spell effects to target - // TODO: move this code to scripts - if (m_preCastSpell) - { - // Paladin immunity shields - if (m_preCastSpell == 61988) - { - // Cast Forbearance - m_caster->CastSpell(unit, 25771, true); - // Cast Avenging Wrath Marker - unit->CastSpell(unit, 61987, true); - } + for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) + if (!m_spellInfo->Effects[effIndex].IsEffect() || !CheckEffectTarget(target, effIndex)) + effectMask &= ~(1 << effIndex); - // Avenging Wrath - if (m_preCastSpell == 61987) - // Cast the serverside immunity shield marker - m_caster->CastSpell(unit, 61988, true); + // no effects left + if (!effectMask) + return; - if (sSpellMgr->GetSpellInfo(m_preCastSpell)) - // Blizz seems to just apply aura without bothering to cast - m_caster->AddAura(m_preCastSpell, unit); - } + if (checkIfValid) + if (m_spellInfo->CheckTarget(m_caster, target, true) != SPELL_CAST_OK) + return; - // handle SPELL_AURA_ADD_TARGET_TRIGGER auras - // this is executed after spell proc spells on target hit - // spells are triggered for each hit spell target - // info confirmed with retail sniffs of permafrost and shadow weaving - if (!m_hitTriggerSpells.empty()) + // Check for effect immune skip if immuned + for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) + if (target->IsImmunedToSpellEffect(m_spellInfo, effIndex)) + effectMask &= ~(1 << effIndex); + + uint64 targetGUID = target->GetGUID(); + + // Lookup target in already in list + for (std::list::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { - int _duration = 0; - for (HitTriggerSpells::const_iterator i = m_hitTriggerSpells.begin(); i != m_hitTriggerSpells.end(); ++i) + if (targetGUID == ihit->targetGUID) // Found in list { - if (CanExecuteTriggersOnHit(effMask, i->first) && roll_chance_i(i->second)) + ihit->effectMask |= effectMask; // Immune effects removed from mask + ihit->scaleAura = false; + if (m_auraScaleMask && ihit->effectMask == m_auraScaleMask && m_caster != target) { - m_caster->CastSpell(unit, i->first, true); - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->first->Id); - - // SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration - // set duration of current aura to the triggered spell - if (i->first->GetDuration() == -1) - { - if (Aura* triggeredAur = unit->GetAura(i->first->Id, m_caster->GetGUID())) - { - // get duration from aura-only once - if (!_duration) - { - Aura* aur = unit->GetAura(m_spellInfo->Id, m_caster->GetGUID()); - _duration = aur ? aur->GetDuration() : -1; - } - triggeredAur->SetDuration(_duration); - } - } + SpellInfo const* auraSpell = sSpellMgr->GetSpellInfo(sSpellMgr->GetFirstSpellInChain(m_spellInfo->Id)); + if (uint32(target->getLevel() + 10) >= auraSpell->SpellLevel) + ihit->scaleAura = true; } + return; } } - // trigger linked auras remove/apply - // TODO: remove/cleanup this, as this table is not documented and people are doing stupid things with it - if (std::vector const* spellTriggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id + SPELL_LINK_HIT)) - for (std::vector::const_iterator i = spellTriggered->begin(); i != spellTriggered->end(); ++i) - if (*i < 0) - unit->RemoveAurasDueToSpell(-(*i)); - else - unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID()); -} + // This is new target calculate data for him -void Spell::DoAllEffectOnTarget(GOTargetInfo* target) -{ - if (target->processed) // Check target - return; - target->processed = true; // Target checked in apply effects procedure + // Get spell hit result on target + TargetInfo targetInfo; + targetInfo.targetGUID = targetGUID; // Store target GUID + targetInfo.effectMask = effectMask; // Store all effects not immune + targetInfo.processed = false; // Effects not apply on target + targetInfo.alive = target->isAlive(); + targetInfo.damage = 0; + targetInfo.crit = false; + targetInfo.scaleAura = false; + if (m_auraScaleMask && targetInfo.effectMask == m_auraScaleMask && m_caster != target) + { + SpellInfo const* auraSpell = sSpellMgr->GetSpellInfo(sSpellMgr->GetFirstSpellInChain(m_spellInfo->Id)); + if (uint32(target->getLevel() + 10) >= auraSpell->SpellLevel) + targetInfo.scaleAura = true; + } - uint32 effectMask = target->effectMask; - if (!effectMask) - return; + // Calculate hit result + if (m_originalCaster) + { + targetInfo.missCondition = m_originalCaster->SpellHitResult(target, m_spellInfo, m_canReflect); + if (m_skipCheck && targetInfo.missCondition != SPELL_MISS_IMMUNE) + targetInfo.missCondition = SPELL_MISS_NONE; + } + else + targetInfo.missCondition = SPELL_MISS_EVADE; //SPELL_MISS_NONE; - GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID); - if (!go) - return; + // Spell have speed - need calculate incoming time + // Incoming time is zero for self casts. At least I think so. + if (m_spellInfo->Speed > 0.0f && m_caster != target) + { + // calculate spell incoming interval + // TODO: this is a hack + float dist = m_caster->GetDistance(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); - PrepareScriptHitHandlers(); - CallScriptBeforeHitHandlers(); + if (dist < 5.0f) + dist = 5.0f; + targetInfo.timeDelay = (uint64) floor(dist / m_spellInfo->Speed * 1000.0f); - for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber) - if (effectMask & (1 << effectNumber)) - HandleEffects(NULL, NULL, go, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET); + // Calculate minimum incoming time + if (m_delayMoment == 0 || m_delayMoment > targetInfo.timeDelay) + m_delayMoment = targetInfo.timeDelay; + } + else + targetInfo.timeDelay = 0LL; - CallScriptOnHitHandlers(); + // If target reflect spell back to caster + if (targetInfo.missCondition == SPELL_MISS_REFLECT) + { + // Calculate reflected spell result on caster + targetInfo.reflectResult = m_caster->SpellHitResult(m_caster, m_spellInfo, m_canReflect); - // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) - // ignore autorepeat/melee casts for speed (not exist quest for spells (hm...) - if (m_originalCaster && m_originalCaster->IsControlledByPlayer() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive()) - if (Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself()) - p->CastedCreatureOrGO(go->GetEntry(), go->GetGUID(), m_spellInfo->Id); - CallScriptAfterHitHandlers(); -} + if (targetInfo.reflectResult == SPELL_MISS_REFLECT) // Impossible reflect again, so simply deflect spell + targetInfo.reflectResult = SPELL_MISS_PARRY; -void Spell::DoAllEffectOnTarget(ItemTargetInfo* target) -{ - uint32 effectMask = target->effectMask; - if (!target->item || !effectMask) - return; - - PrepareScriptHitHandlers(); - CallScriptBeforeHitHandlers(); - - for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber) - if (effectMask & (1 << effectNumber)) - HandleEffects(NULL, target->item, NULL, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET); - - CallScriptOnHitHandlers(); + // Increase time interval for reflected spells by 1.5 + targetInfo.timeDelay += targetInfo.timeDelay >> 1; + } + else + targetInfo.reflectResult = SPELL_MISS_NONE; - CallScriptAfterHitHandlers(); + // Add target to list + m_UniqueTargetInfo.push_back(targetInfo); } -bool Spell::UpdateChanneledTargetList() +void Spell::AddGOTarget(GameObject* go, uint32 effectMask) { - // Not need check return true - if (m_channelTargetEffectMask == 0) - return true; - - uint8 channelTargetEffectMask = m_channelTargetEffectMask; - uint8 channelAuraMask = 0; - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_APPLY_AURA) - channelAuraMask |= 1<GetMaxRange(m_spellInfo->IsPositive()); - if (Player* modOwner = m_caster->GetSpellModOwner()) - modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this); - } - - for (std::list::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) { - if (ihit->missCondition == SPELL_MISS_NONE && (channelTargetEffectMask & ihit->effectMask)) + if (!m_spellInfo->Effects[effIndex].IsEffect()) + effectMask &= ~(1 << effIndex); + else { - Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); - - if (!unit) - continue; - - if (IsValidDeadOrAliveTarget(unit)) + switch (m_spellInfo->Effects[effIndex].Effect) { - if (channelAuraMask & ihit->effectMask) - { - if (AuraApplication * aurApp = unit->GetAuraApplication(m_spellInfo->Id, m_originalCasterGUID)) - { - if (m_caster != unit && !m_caster->IsWithinDistInMap(unit, range)) - { - ihit->effectMask &= ~aurApp->GetEffectMask(); - unit->RemoveAura(aurApp); - continue; - } - } - else // aura is dispelled - continue; - } - - channelTargetEffectMask &= ~ihit->effectMask; // remove from need alive mask effect that have alive target + case SPELL_EFFECT_GAMEOBJECT_DAMAGE: + case SPELL_EFFECT_GAMEOBJECT_REPAIR: + case SPELL_EFFECT_GAMEOBJECT_SET_DESTRUCTION_STATE: + if (go->GetGoType() != GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING) + effectMask &= ~(1 << effIndex); + break; + default: + break; } } } - // is all effects from m_needAliveTargetMask have alive targets - return channelTargetEffectMask == 0; -} + if (!effectMask) + return; -// Helper for Chain Healing -// Spell target first -// Raidmates then descending by injury suffered (MaxHealth - Health) -// Other players/mobs then descending by injury suffered (MaxHealth - Health) -struct ChainHealingOrder : public std::binary_function -{ - const Unit* MainTarget; - ChainHealingOrder(Unit const* Target) : MainTarget(Target) {}; - // functor for operator ">" - bool operator()(Unit const* _Left, Unit const* _Right) const - { - return (ChainHealingHash(_Left) < ChainHealingHash(_Right)); - } + uint64 targetGUID = go->GetGUID(); - int32 ChainHealingHash(Unit const* Target) const + // Lookup target in already in list + for (std::list::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) { - if (Target->GetTypeId() == TYPEID_PLAYER && MainTarget->GetTypeId() == TYPEID_PLAYER && Target->ToPlayer()->IsInSameRaidWith(MainTarget->ToPlayer())) + if (targetGUID == ihit->targetGUID) // Found in list { - if (Target->IsFullHealth()) - return 40000; - else - return 20000 - Target->GetMaxHealth() + Target->GetHealth(); + ihit->effectMask |= effectMask; // Add only effect mask + return; } - else - return 40000 - Target->GetMaxHealth() + Target->GetHealth(); } -}; -void Spell::SearchChainTarget(std::list &TagUnitMap, float max_range, uint32 num, SpellTargets TargetType) -{ - Unit* cur = m_targets.GetUnitTarget(); - if (!cur) - return; + // This is new target calculate data for him - //FIXME: This very like horrible hack and wrong for most spells - if (m_spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MELEE) - max_range += num * CHAIN_SPELL_JUMP_RADIUS; + GOTargetInfo target; + target.targetGUID = targetGUID; + target.effectMask = effectMask; + target.processed = false; // Effects not apply on target - std::list tempUnitMap; - if (TargetType == SPELL_TARGETS_CHAINHEAL) + // Spell have speed - need calculate incoming time + if (m_spellInfo->Speed > 0.0f) { - SearchAreaTarget(tempUnitMap, max_range, PUSH_CHAIN, SPELL_TARGETS_ALLY); - tempUnitMap.sort(ChainHealingOrder(m_caster)); + // calculate spell incoming interval + float dist = m_caster->GetDistance(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ()); + if (dist < 5.0f) + dist = 5.0f; + target.timeDelay = uint64(floor(dist / m_spellInfo->Speed * 1000.0f)); + if (m_delayMoment == 0 || m_delayMoment > target.timeDelay) + m_delayMoment = target.timeDelay; } else - SearchAreaTarget(tempUnitMap, max_range, PUSH_CHAIN, TargetType); - tempUnitMap.remove(cur); - - while (num) - { - TagUnitMap.push_back(cur); - --num; - - if (tempUnitMap.empty()) - break; - - std::list::iterator next; - - if (TargetType == SPELL_TARGETS_CHAINHEAL) - { - next = tempUnitMap.begin(); - while (cur->GetDistance(*next) > CHAIN_SPELL_JUMP_RADIUS || !cur->IsWithinLOSInMap(*next)) - { - ++next; - if (next == tempUnitMap.end()) - return; - } - } - else - { - tempUnitMap.sort(Trinity::ObjectDistanceOrderPred(cur)); - next = tempUnitMap.begin(); - - if (cur->GetDistance(*next) > CHAIN_SPELL_JUMP_RADIUS) // Don't search beyond the max jump radius - break; + target.timeDelay = 0LL; - // Check if (*next) is a valid chain target. If not, don't add to TagUnitMap, and repeat loop. - // If you want to add any conditions to exclude a target from TagUnitMap, add condition in this while () loop. - while ((m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE - && !m_caster->isInFrontInMap(*next, max_range)) - || !m_caster->canSeeOrDetect(*next) - || !cur->IsWithinLOSInMap(*next) - || (*next)->GetCreatureType() == CREATURE_TYPE_CRITTER - || ((GetSpellInfo()->AttributesEx6 & SPELL_ATTR6_CANT_TARGET_CROWD_CONTROLLED) && !(*next)->CanFreeMove())) - { - ++next; - if (next == tempUnitMap.end() || cur->GetDistance(*next) > CHAIN_SPELL_JUMP_RADIUS) // Don't search beyond the max jump radius - return; - } - } + // Add target to list + m_UniqueGOTargetInfo.push_back(target); +} - cur = *next; - tempUnitMap.erase(next); - } +void Spell::AddGOTarget(uint64 goGUID, uint32 effectMask) +{ + if (GameObject* go = m_caster->GetMap()->GetGameObject(goGUID)) + AddGOTarget(go, effectMask); } -void Spell::SearchAreaTarget(std::list &TagUnitMap, float radius, SpellNotifyPushType type, SpellTargets TargetType, uint32 entry) +void Spell::AddItemTarget(Item* item, uint32 effectMask) { - if (TargetType == SPELL_TARGETS_GO) + for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) + if (!m_spellInfo->Effects[effIndex].IsEffect()) + effectMask &= ~(1 << effIndex); + + // no effects left + if (!effectMask) return; - Position const* pos; - switch (type) + // Lookup target in already in list + for (std::list::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) { - case PUSH_DST_CENTER: - CheckDst(); - pos = m_targets.GetDst(); - break; - case PUSH_SRC_CENTER: - CheckSrc(); - pos = m_targets.GetSrc(); - break; - case PUSH_CHAIN: + if (item == ihit->item) // Found in list { - Unit* target = m_targets.GetUnitTarget(); - if (!target) - { - sLog->outError("SPELL: cannot find unit target for spell ID %u\n", m_spellInfo->Id); - return; - } - pos = target; - break; + ihit->effectMask |= effectMask; // Add only effect mask + return; } - default: - pos = m_caster; - break; } - Trinity::SpellNotifierCreatureAndPlayer notifier(m_caster, TagUnitMap, radius, type, TargetType, pos, entry, m_spellInfo); - if ((m_spellInfo->AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_PLAYERS) || (TargetType == SPELL_TARGETS_ENTRY && !entry)) - m_caster->GetMap()->VisitWorld(pos->m_positionX, pos->m_positionY, radius, notifier); - else - m_caster->GetMap()->VisitAll(pos->m_positionX, pos->m_positionY, radius, notifier); + // This is new target add data + + ItemTargetInfo target; + target.item = item; + target.effectMask = effectMask; + + m_UniqueItemInfo.push_back(target); } -void Spell::SearchGOAreaTarget(std::list &TagGOMap, float radius, SpellNotifyPushType type, SpellTargets TargetType, uint32 entry) +void Spell::DoAllEffectOnTarget(TargetInfo* target) { - if (TargetType != SPELL_TARGETS_GO) + if (!target || target->processed) return; - Position const* pos; - switch (type) - { - case PUSH_DST_CENTER: - CheckDst(); - pos = m_targets.GetDst(); - break; - case PUSH_SRC_CENTER: - CheckSrc(); - pos = m_targets.GetSrc(); - break; - default: - pos = m_caster; - break; - } + target->processed = true; // Target checked in apply effects procedure - Trinity::GameObjectInRangeCheck check(pos->m_positionX, pos->m_positionY, pos->m_positionZ, radius, entry); - Trinity::GameObjectListSearcher searcher(m_caster, TagGOMap, check); - m_caster->GetMap()->VisitGrid(pos->m_positionX, pos->m_positionY, radius, searcher); -} + // Get mask of effects for target + uint8 mask = target->effectMask; -WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType, SpellEffIndex effIndex) -{ - switch (TargetType) + Unit* unit = m_caster->GetGUID() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target->targetGUID); + if (!unit) { - case SPELL_TARGETS_ENTRY: - { - ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET, m_spellInfo->Id); - if (conditions.empty()) - { - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell (ID: %u) (caster Entry: %u) does not have record in `conditions` for spell script target (ConditionSourceType 13)", m_spellInfo->Id, m_caster->GetEntry()); - if (m_spellInfo->IsPositive()) - return SearchNearbyTarget(range, SPELL_TARGETS_ALLY, effIndex); - else - return SearchNearbyTarget(range, SPELL_TARGETS_ENEMY, effIndex); - } - - Creature* creatureScriptTarget = NULL; - GameObject* goScriptTarget = NULL; + uint8 farMask = 0; + // create far target mask + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (m_spellInfo->Effects[i].IsFarUnitTargetEffect()) + if ((1 << i) & mask) + farMask |= (1 << i); - for (ConditionList::const_iterator i_spellST = conditions.begin(); i_spellST != conditions.end(); ++i_spellST) - { - if ((*i_spellST)->ConditionType != CONDITION_SPELL_SCRIPT_TARGET) - continue; - if ((*i_spellST)->ConditionValue3 && !((*i_spellST)->ConditionValue3 & (1 << uint32(effIndex)))) - continue; - switch ((*i_spellST)->ConditionValue1) - { - case SPELL_TARGET_TYPE_CONTROLLED: - for (Unit::ControlList::iterator itr = m_caster->m_Controlled.begin(); itr != m_caster->m_Controlled.end(); ++itr) - if ((*itr)->GetEntry() == (*i_spellST)->ConditionValue2 && (*itr)->IsWithinDistInMap(m_caster, range)) - { - goScriptTarget = NULL; - creatureScriptTarget = (*itr)->ToCreature(); - range = m_caster->GetDistance(creatureScriptTarget); - } - break; - case SPELL_TARGET_TYPE_GAMEOBJECT: - if ((*i_spellST)->ConditionValue2) - { - if (GameObject* go = m_caster->FindNearestGameObject((*i_spellST)->ConditionValue2, range)) - { - // remember found target and range, next attempt will find more near target with another entry - goScriptTarget = go; - creatureScriptTarget = NULL; - range = m_caster->GetDistance(goScriptTarget); - } - } - else if (focusObject) //Focus Object - { - float frange = m_caster->GetDistance(focusObject); - if (range >= frange) - { - creatureScriptTarget = NULL; - goScriptTarget = focusObject; - range = frange; - } - } - break; - case SPELL_TARGET_TYPE_CREATURE: - if (m_targets.GetUnitTarget() && m_targets.GetUnitTarget()->GetEntry() == (*i_spellST)->ConditionValue2) - return m_targets.GetUnitTarget(); - case SPELL_TARGET_TYPE_DEAD: - default: - if (Creature* cre = m_caster->FindNearestCreature((*i_spellST)->ConditionValue2, range, (*i_spellST)->ConditionValue1 != SPELL_TARGET_TYPE_DEAD)) - { - creatureScriptTarget = cre; - goScriptTarget = NULL; - range = m_caster->GetDistance(creatureScriptTarget); - } - break; - } - } + if (!farMask) + return; + // find unit in world + unit = ObjectAccessor::FindUnit(target->targetGUID); + if (!unit) + return; - if (creatureScriptTarget) - return creatureScriptTarget; - else - return goScriptTarget; - } - default: - case SPELL_TARGETS_ENEMY: - { - Unit* target = NULL; - Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(m_caster, m_caster, range); - Trinity::UnitLastSearcher searcher(m_caster, target, u_check); - m_caster->VisitNearbyObject(range, searcher); - return target; - } - case SPELL_TARGETS_ALLY: - { - Unit* target = NULL; - Trinity::AnyFriendlyUnitInObjectRangeCheck u_check(m_caster, m_caster, range); - Trinity::UnitLastSearcher searcher(m_caster, target, u_check); - m_caster->VisitNearbyObject(range, searcher); - return target; - } + // do far effects on the unit + // can't use default call because of threading, do stuff as fast as possible + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (farMask & (1 << i)) + HandleEffects(unit, NULL, NULL, i, SPELL_EFFECT_HANDLE_HIT_TARGET); + return; } -} -uint32 Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) -{ - SpellNotifyPushType pushType = PUSH_NONE; - Player* modOwner = NULL; - if (m_originalCaster) - modOwner = m_originalCaster->GetSpellModOwner(); + if (unit->isAlive() != target->alive) + return; - uint32 effectMask = 1 << i; - // ENTRY targets may have different selection lists, skip those for now until we can compare lists easily and quickly - if (GetSpellInfo()->Effects[i].TargetA.GetSelectionCheckType() != TARGET_SELECT_CHECK_ENTRY && - GetSpellInfo()->Effects[i].TargetB.GetSelectionCheckType() != TARGET_SELECT_CHECK_ENTRY) - for (uint32 j = i + 1; j < MAX_SPELL_EFFECTS; ++j) - if (GetSpellInfo()->Effects[i].TargetA.GetTarget() == GetSpellInfo()->Effects[j].TargetA.GetTarget() && - GetSpellInfo()->Effects[i].TargetB.GetTarget() == GetSpellInfo()->Effects[j].TargetB.GetTarget() && - GetSpellInfo()->Effects[i].CalcRadius(m_caster) == GetSpellInfo()->Effects[j].CalcRadius(m_caster)) - effectMask |= 1 << j; + if (getState() == SPELL_STATE_DELAYED && !m_spellInfo->IsPositive() && (getMSTime() - target->timeDelay) <= unit->m_lastSanctuaryTime) + return; // No missinfo in that case - switch (cur.GetType()) - { - case TARGET_TYPE_UNIT_CASTER: - { - switch (cur.GetTarget()) - { - case TARGET_UNIT_CASTER: - AddUnitTarget(m_caster, effectMask, false); - break; - case TARGET_DEST_CASTER_FISHING: - { - float min_dis = m_spellInfo->GetMinRange(true); - float max_dis = m_spellInfo->GetMaxRange(true); - float dis = (float)rand_norm() * (max_dis - min_dis) + min_dis; - float x, y, z, angle; - angle = (float)rand_norm() * static_cast(M_PI * 35.0f / 180.0f) - static_cast(M_PI * 17.5f / 180.0f); - m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dis, angle); - m_targets.SetDst(x, y, z, m_caster->GetOrientation()); - break; - } - case TARGET_UNIT_MASTER: - if (Unit* owner = m_caster->GetCharmerOrOwner()) - AddUnitTarget(owner, effectMask); - break; - case TARGET_UNIT_PET: - if (Guardian* pet = m_caster->GetGuardianPet()) - AddUnitTarget(pet, effectMask); - break; - case TARGET_UNIT_SUMMONER: - if (m_caster->isSummon()) - if (Unit* unit = m_caster->ToTempSummon()->GetSummoner()) - AddUnitTarget(unit, effectMask); - break; - case TARGET_UNIT_CASTER_AREA_PARTY: - case TARGET_UNIT_CASTER_AREA_RAID: - pushType = PUSH_CASTER_CENTER; - break; - case TARGET_UNIT_VEHICLE: - if (Unit* vehicle = m_caster->GetVehicleBase()) - AddUnitTarget(vehicle, effectMask); - break; - case TARGET_UNIT_PASSENGER_0: - case TARGET_UNIT_PASSENGER_1: - case TARGET_UNIT_PASSENGER_2: - case TARGET_UNIT_PASSENGER_3: - case TARGET_UNIT_PASSENGER_4: - case TARGET_UNIT_PASSENGER_5: - case TARGET_UNIT_PASSENGER_6: - case TARGET_UNIT_PASSENGER_7: - if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsVehicle()) - if (Unit* unit = m_caster->GetVehicleKit()->GetPassenger(cur.GetTarget() - TARGET_UNIT_PASSENGER_0)) - AddUnitTarget(unit, effectMask); - break; - default: - break; - } - break; - } - - case TARGET_TYPE_UNIT_TARGET: - { - Unit* target = m_targets.GetUnitTarget(); - if (!target) - { - sLog->outError("SPELL: no unit target for spell ID %u", m_spellInfo->Id); - break; - } - - switch (cur.GetTarget()) - { - case TARGET_UNIT_TARGET_ENEMY: - case TARGET_UNIT_TARGET_ANY: - pushType = PUSH_CHAIN; - break; - case TARGET_UNIT_TARGET_CHAINHEAL_ALLY: - pushType = PUSH_CHAIN; - break; - case TARGET_UNIT_TARGET_ALLY: - AddUnitTarget(target, effectMask, false); - break; - case TARGET_UNIT_TARGET_RAID: - case TARGET_UNIT_TARGET_PARTY: - case TARGET_UNIT_TARGET_MINIPET: - AddUnitTarget(target, effectMask, false); - break; - case TARGET_UNIT_TARGET_PASSENGER: - AddUnitTarget(target, effectMask, false); - break; - case TARGET_UNIT_LASTTARGET_AREA_PARTY: - case TARGET_UNIT_TARGET_AREA_RAID_CLASS: - pushType = PUSH_CASTER_CENTER; // not real - break; - default: - break; - } - break; - } - - case TARGET_TYPE_UNIT_NEARBY: - { - WorldObject* target = NULL; - float range; + // Get original caster (if exist) and calculate damage/healing from him data + Unit* caster = m_originalCaster ? m_originalCaster : m_caster; - switch (cur.GetTarget()) - { - case TARGET_UNIT_NEARBY_ENEMY: - range = m_spellInfo->GetMaxRange(false); - if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this); - target = SearchNearbyTarget(range, SPELL_TARGETS_ENEMY, SpellEffIndex(i)); - break; - case TARGET_UNIT_NEARBY_ALLY: - case TARGET_UNIT_NEARBY_PARTY: // TODO: fix party/raid targets - case TARGET_UNIT_NEARBY_RAID: - range = m_spellInfo->GetMaxRange(true); - if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this); - target = SearchNearbyTarget(range, SPELL_TARGETS_ALLY, SpellEffIndex(i)); - break; - case TARGET_UNIT_NEARBY_ENTRY: - case TARGET_GAMEOBJECT_NEARBY_ENTRY: - range = m_spellInfo->GetMaxRange(m_spellInfo->IsPositive()); - if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this); - target = SearchNearbyTarget(range, SPELL_TARGETS_ENTRY, SpellEffIndex(i)); - break; - default: - break; - } + // Skip if m_originalCaster not avaiable + if (!caster) + return; - if (!target) - return 0; - else if (target->GetTypeId() == TYPEID_GAMEOBJECT) - AddGOTarget((GameObject*)target, effectMask); - else - { - pushType = PUSH_CHAIN; + SpellMissInfo missInfo = target->missCondition; - if (m_targets.GetUnitTarget() != target) - m_targets.SetUnitTarget((Unit*)target); - } + // Need init unitTarget by default unit (can changed in code on reflect) + // Or on missInfo != SPELL_MISS_NONE unitTarget undefined (but need in trigger subsystem) + unitTarget = unit; - break; - } + // Reset damage/healing counter + m_damage = target->damage; + m_healing = -target->damage; - case TARGET_TYPE_AREA_SRC: - pushType = PUSH_SRC_CENTER; - break; + // Fill base trigger info + uint32 procAttacker = m_procAttacker; + uint32 procVictim = m_procVictim; + uint32 procEx = m_procEx; - case TARGET_TYPE_AREA_DST: - pushType = PUSH_DST_CENTER; - break; + m_spellAura = NULL; // Set aura to null for every target-make sure that pointer is not used for unit without aura applied - case TARGET_TYPE_AREA_CONE: - if (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_CONE_BACK) - pushType = PUSH_IN_BACK; - else if (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_CONE_LINE) - pushType = PUSH_IN_LINE; - else - pushType = PUSH_IN_FRONT; - break; + //Spells with this flag cannot trigger if effect is casted on self + bool canEffectTrigger = !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_CANT_TRIGGER_PROC) && unitTarget->CanProc() && CanExecuteTriggersOnHit(mask); + Unit* spellHitTarget = NULL; - case TARGET_TYPE_DEST_CASTER: //4+8+2 + if (missInfo == SPELL_MISS_NONE) // In case spell hit target, do all effect on that target + spellHitTarget = unit; + else if (missInfo == SPELL_MISS_REFLECT) // In case spell reflect from target, do all effect on caster (if hit) + { + if (target->reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him { - if (cur.GetTarget() == TARGET_SRC_CASTER) - { - m_targets.SetSrc(*m_caster); - break; - } - else if (cur.GetTarget() == TARGET_DEST_CASTER) - { - m_targets.SetDst(*m_caster); - break; - } - - float angle, dist; - - float objSize = m_caster->GetObjectSize(); - if (cur.GetTarget() == TARGET_DEST_CASTER_SUMMON) - dist = 0.0f; - else - dist = m_spellInfo->Effects[i].CalcRadius(m_caster); - if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, dist, this); - if (dist < objSize) - dist = objSize; - else if (cur.GetTarget() == TARGET_DEST_CASTER_RANDOM) - dist = objSize + (dist - objSize) * (float)rand_norm(); - - switch (cur.GetTarget()) - { - case TARGET_DEST_CASTER_FRONT_LEFT: angle = static_cast(-M_PI/4); break; - case TARGET_DEST_CASTER_BACK_LEFT: angle = static_cast(-3*M_PI/4); break; - case TARGET_DEST_CASTER_BACK_RIGHT: angle = static_cast(3*M_PI/4); break; - case TARGET_DEST_CASTER_FRONT_RIGHT:angle = static_cast(M_PI/4); break; - case TARGET_DEST_CASTER_SUMMON: - case TARGET_DEST_CASTER_FRONT_LEAP: - case TARGET_DEST_CASTER_FRONT: angle = 0.0f; break; - case TARGET_DEST_CASTER_BACK: angle = static_cast(M_PI); break; - case TARGET_DEST_CASTER_RIGHT: angle = static_cast(-M_PI/2); break; - case TARGET_DEST_CASTER_LEFT: angle = static_cast(M_PI/2); break; - default: angle = (float)rand_norm()*static_cast(2*M_PI); break; - } - - Position pos; - if (cur.GetTarget() == TARGET_DEST_CASTER_FRONT_LEAP) - m_caster->GetFirstCollisionPosition(pos, dist, angle); - else - m_caster->GetNearPosition(pos, dist, angle); - m_targets.SetDst(*m_caster); - m_targets.ModDst(pos); - break; + spellHitTarget = m_caster; + if (m_caster->GetTypeId() == TYPEID_UNIT) + m_caster->ToCreature()->LowerPlayerDamageReq(target->damage); } + } - case TARGET_TYPE_DEST_TARGET: //2+8+2 + if (spellHitTarget) + { + SpellMissInfo missInfo2 = DoSpellHitOnUnit(spellHitTarget, mask, target->scaleAura); + if (missInfo2 != SPELL_MISS_NONE) { - Unit* target = m_targets.GetUnitTarget(); - if (!target) - { - sLog->outError("SPELL: no unit target for spell ID %u", m_spellInfo->Id); - break; - } - - if (cur.GetTarget() == TARGET_DEST_TARGET_ENEMY || cur.GetTarget() == TARGET_DEST_TARGET_ANY) - { - m_targets.SetDst(*target); - break; - } - - float angle, dist; - - float objSize = target->GetObjectSize(); - dist = m_spellInfo->Effects[i].CalcRadius(m_caster); - if (dist < objSize) - dist = objSize; - else if (cur.GetTarget() == TARGET_DEST_TARGET_RANDOM) - dist = objSize + (dist - objSize) * (float)rand_norm(); - - switch (cur.GetTarget()) - { - case TARGET_DEST_TARGET_FRONT: angle = 0.0f; break; - case TARGET_DEST_TARGET_BACK: angle = static_cast(M_PI); break; - case TARGET_DEST_TARGET_RIGHT: angle = static_cast(M_PI/2); break; - case TARGET_DEST_TARGET_LEFT: angle = static_cast(-M_PI/2); break; - case TARGET_DEST_TARGET_FRONT_LEFT: angle = static_cast(-M_PI/4); break; - case TARGET_DEST_TARGET_BACK_LEFT: angle = static_cast(-3*M_PI/4); break; - case TARGET_DEST_TARGET_BACK_RIGHT: angle = static_cast(3*M_PI/4); break; - case TARGET_DEST_TARGET_FRONT_RIGHT:angle = static_cast(M_PI/4); break; - default: angle = (float)rand_norm()*static_cast(2*M_PI); break; - } - - Position pos; - target->GetNearPosition(pos, dist, angle); - m_targets.SetDst(*target); - m_targets.ModDst(pos); - break; + if (missInfo2 != SPELL_MISS_MISS) + m_caster->SendSpellMiss(unit, m_spellInfo->Id, missInfo2); + m_damage = 0; + spellHitTarget = NULL; } + } - case TARGET_TYPE_DEST_DEST: //5+8+1 - { - if (!m_targets.HasDst()) - { - sLog->outError("SPELL: no destination for spell ID %u", m_spellInfo->Id); - break; - } - - float angle; - switch (cur.GetTarget()) - { - case TARGET_DEST_DYNOBJ_ENEMY: - case TARGET_DEST_DYNOBJ_ALLY: - case TARGET_DEST_DYNOBJ_NONE: - case TARGET_DEST_DEST: - return effectMask; - case TARGET_DEST_TRAJ: - SelectTrajTargets(); - return effectMask; - case TARGET_DEST_DEST_FRONT: angle = 0.0f; break; - case TARGET_DEST_DEST_BACK: angle = static_cast(M_PI); break; - case TARGET_DEST_DEST_RIGHT: angle = static_cast(M_PI/2); break; - case TARGET_DEST_DEST_LEFT: angle = static_cast(-M_PI/2); break; - case TARGET_DEST_DEST_FRONT_LEFT: angle = static_cast(-M_PI/4); break; - case TARGET_DEST_DEST_BACK_LEFT: angle = static_cast(-3*M_PI/4); break; - case TARGET_DEST_DEST_BACK_RIGHT: angle = static_cast(3*M_PI/4); break; - case TARGET_DEST_DEST_FRONT_RIGHT:angle = static_cast(M_PI/4); break; - default: angle = (float)rand_norm()*static_cast(2*M_PI); break; - } - - float dist = m_spellInfo->Effects[i].CalcRadius(m_caster); - if (cur.GetTarget() == TARGET_DEST_DEST_RANDOM || cur.GetTarget() == TARGET_DEST_DEST_RADIUS) - dist *= (float)rand_norm(); - - // must has dst, no need to set flag - Position pos = *m_targets.GetDst(); - m_caster->MovePosition(pos, dist, angle); - m_targets.ModDst(pos); - break; - } + // Do not take combo points on dodge and miss + if (missInfo != SPELL_MISS_NONE && m_needComboPoints && + m_targets.GetUnitTargetGUID() == target->targetGUID) + { + m_needComboPoints = false; + // Restore spell mods for a miss/dodge/parry Cold Blood + // TODO: check how broad this rule should be + if (m_caster->GetTypeId() == TYPEID_PLAYER && (missInfo == SPELL_MISS_MISS || + missInfo == SPELL_MISS_DODGE || missInfo == SPELL_MISS_PARRY)) + m_caster->ToPlayer()->RestoreSpellMods(this, 14177); + } - case TARGET_TYPE_DEST_SPECIAL: + // Trigger info was not filled in spell::preparedatafortriggersystem - we do it now + if (canEffectTrigger && !procAttacker && !procVictim) + { + bool positive = true; + if (m_damage > 0) + positive = false; + else if (!m_healing) { - switch (cur.GetTarget()) - { - case TARGET_DEST_DB: - if (SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id)) - { - //TODO: fix this check - if (m_spellInfo->Effects[0].Effect == SPELL_EFFECT_TELEPORT_UNITS || m_spellInfo->Effects[1].Effect == SPELL_EFFECT_TELEPORT_UNITS || m_spellInfo->Effects[2].Effect == SPELL_EFFECT_TELEPORT_UNITS) - m_targets.SetDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation, (int32)st->target_mapId); - else if (st->target_mapId == m_caster->GetMapId()) - m_targets.SetDst(st->target_X, st->target_Y, st->target_Z, st->target_Orientation); - } - else - { - sLog->outError("SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id); - Unit* target = NULL; - if (uint64 guid = m_caster->GetUInt64Value(UNIT_FIELD_TARGET)) - target = ObjectAccessor::GetUnit(*m_caster, guid); - m_targets.SetDst(target ? *target : *m_caster); - } - break; - case TARGET_DEST_HOME: - if (m_caster->GetTypeId() == TYPEID_PLAYER) - m_targets.SetDst(m_caster->ToPlayer()->m_homebindX, m_caster->ToPlayer()->m_homebindY, m_caster->ToPlayer()->m_homebindZ, m_caster->ToPlayer()->GetOrientation(), m_caster->ToPlayer()->m_homebindMapId); - break; - case TARGET_DEST_NEARBY_ENTRY: + for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i) + // If at least one effect negative spell is negative hit + if (mask & (1<IsPositiveEffect(i)) { - float range = m_spellInfo->GetMaxRange(m_spellInfo->IsPositive()); - if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this); - - if (WorldObject* target = SearchNearbyTarget(range, SPELL_TARGETS_ENTRY, SpellEffIndex(i))) - m_targets.SetDst(*target); + positive = false; break; } - default: - break; - } - break; } - - case TARGET_TYPE_CHANNEL: + switch (m_spellInfo->DmgClass) { - if (!m_originalCaster || !m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - { - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: no current channeled spell for spell ID %u - spell triggering this spell was interrupted.", m_spellInfo->Id); - break; - } - - switch (cur.GetTarget()) - { - case TARGET_UNIT_CHANNEL_TARGET: - // unit target may be no longer avalible - teleported out of map for example - if (Unit* target = Unit::GetUnit(*m_caster, m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.GetUnitTargetGUID())) - AddUnitTarget(target, effectMask); - else - sLog->outError("SPELL: cannot find channel spell target for spell ID %u", m_spellInfo->Id); - break; - case TARGET_DEST_CHANNEL_TARGET: - if (m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.HasDst()) - m_targets.SetDst(m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets); - else if (Unit* target = Unit::GetUnit(*m_caster, m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.GetUnitTargetGUID())) - m_targets.SetDst(*target); - else - sLog->outError("SPELL: cannot find channel spell destination for spell ID %u", m_spellInfo->Id); - break; - case TARGET_DEST_CHANNEL_CASTER: - m_targets.SetDst(*m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->GetCaster()); - break; - default: - break; - } + case SPELL_DAMAGE_CLASS_MAGIC: + if (positive) + { + procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS; + procVictim |= PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS; + } + else + { + procAttacker |= PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG; + procVictim |= PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG; + } break; - } - - default: - { - switch (cur.GetTarget()) - { - case TARGET_GAMEOBJECT_TARGET: - if (m_targets.GetGOTarget()) - AddGOTarget(m_targets.GetGOTarget(), effectMask); - break; - case TARGET_GAMEOBJECT_ITEM_TARGET: - if (m_targets.GetGOTargetGUID()) - AddGOTarget(m_targets.GetGOTarget(), effectMask); - else if (m_targets.GetItemTarget()) - AddItemTarget(m_targets.GetItemTarget(), effectMask); - break; - default: - sLog->outError("SPELL (caster[type: %u; guidlow: %u], spell: %u): unhandled spell target (%u)", - m_caster->GetTypeId(), m_caster->GetGUIDLow(), m_spellInfo->Id, cur.GetTarget()); - break; - } + case SPELL_DAMAGE_CLASS_NONE: + if (positive) + { + procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS; + procVictim |= PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS; + } + else + { + procAttacker |= PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG; + procVictim |= PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG; + } break; } } + CallScriptOnHitHandlers(); - if (pushType == PUSH_CHAIN) // Chain + // All calculated do it! + // Do healing and triggers + if (m_healing > 0) { - Unit* target = m_targets.GetUnitTarget(); - if (!target) + bool crit = caster->isSpellCrit(unitTarget, m_spellInfo, m_spellSchoolMask); + uint32 addhealth = m_healing; + if (crit) { - sLog->outError("SPELL: no chain unit target for spell ID %u", m_spellInfo->Id); - return 0; + procEx |= PROC_EX_CRITICAL_HIT; + addhealth = caster->SpellCriticalHealingBonus(m_spellInfo, addhealth, NULL); } + else + procEx |= PROC_EX_NORMAL_HIT; - //Chain: 2, 6, 22, 25, 45, 77 - uint32 maxTargets = m_spellInfo->Effects[i].ChainTarget; - if (modOwner) - modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, maxTargets, this); + // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) + if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT) + caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo, m_triggeredByAuraSpell); - if (maxTargets > 1) - { - //otherwise, this multiplier is used for something else - for (uint32 k = i; k < MAX_SPELL_EFFECTS; ++k) - if (effectMask & (1 << k)) - m_damageMultipliers[k] = 1.0f; - m_applyMultiplierMask |= effectMask; + int32 gain = caster->HealBySpell(unitTarget, m_spellInfo, addhealth, crit); + unitTarget->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo); + m_healing = gain; + } + // Do damage and triggers + else if (m_damage > 0) + { + // Fill base damage struct (unitTarget - is real spell target) + SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask); - float range; - std::list unitList; + // Add bonuses and fill damageInfo struct + caster->CalculateSpellDamageTaken(&damageInfo, m_damage, m_spellInfo, m_attackType, target->crit); + caster->DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); - switch (cur.GetTarget()) - { - case TARGET_UNIT_NEARBY_ENEMY: - case TARGET_UNIT_TARGET_ENEMY: - case TARGET_UNIT_NEARBY_ENTRY: // fix me - range = m_spellInfo->GetMaxRange(false); - if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this); - SearchChainTarget(unitList, range, maxTargets, SPELL_TARGETS_ENEMY); - break; - case TARGET_UNIT_TARGET_CHAINHEAL_ALLY: - case TARGET_UNIT_NEARBY_ALLY: // fix me - case TARGET_UNIT_NEARBY_PARTY: - case TARGET_UNIT_NEARBY_RAID: - range = m_spellInfo->GetMaxRange(true); - if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this); - SearchChainTarget(unitList, range, maxTargets, SPELL_TARGETS_CHAINHEAL); - break; - default: - break; - } + // Send log damage message to client + caster->SendSpellNonMeleeDamageLog(&damageInfo); - CallScriptAfterUnitTargetSelectHandlers(unitList, SpellEffIndex(i)); + procEx |= createProcExtendMask(&damageInfo, missInfo); + procVictim |= PROC_FLAG_TAKEN_DAMAGE; - for (std::list::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - AddUnitTarget(*itr, effectMask, false); - } - else - AddUnitTarget(target, effectMask, false); + // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) + if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT) + { + caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo, m_triggeredByAuraSpell); + if (caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->Attributes & SPELL_ATTR0_STOP_ATTACK_TARGET) == 0 && + (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)) + caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx); + } + + caster->DealSpellDamage(&damageInfo, true); + + // Haunt + if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[1] & 0x40000 && m_spellAura && m_spellAura->GetEffect(1)) + { + AuraEffect* aurEff = m_spellAura->GetEffect(1); + aurEff->SetAmount(CalculatePctU(aurEff->GetAmount(), damageInfo.damage)); + } + m_damage = damageInfo.damage; } - else if (pushType) + // Passive spell hits/misses or active spells only misses (only triggers) + else { - float radius; - SpellTargets targetType; - switch (cur.GetTarget()) + // Fill base damage struct (unitTarget - is real spell target) + SpellNonMeleeDamage damageInfo(caster, unitTarget, m_spellInfo->Id, m_spellSchoolMask); + procEx |= createProcExtendMask(&damageInfo, missInfo); + // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) + if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT) + caster->ProcDamageAndSpell(unit, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo, m_triggeredByAuraSpell); + + // Failed Pickpocket, reveal rogue + if (missInfo == SPELL_MISS_RESIST && m_spellInfo->AttributesCu & SPELL_ATTR0_CU_PICKPOCKET && unitTarget->GetTypeId() == TYPEID_UNIT) { - case TARGET_UNIT_SRC_AREA_ENEMY: - case TARGET_UNIT_DEST_AREA_ENEMY: - case TARGET_UNIT_CONE_ENEMY_24: - case TARGET_UNIT_CONE_ENEMY_54: - case TARGET_UNIT_CONE_ENEMY_104: - radius = m_spellInfo->Effects[i].CalcRadius(); - targetType = SPELL_TARGETS_ENEMY; - break; - case TARGET_UNIT_SRC_AREA_ALLY: - case TARGET_UNIT_DEST_AREA_ALLY: - case TARGET_UNIT_CONE_ALLY: - radius = m_spellInfo->Effects[i].CalcRadius(); - targetType = SPELL_TARGETS_ALLY; - break; - case TARGET_UNIT_DEST_AREA_ENTRY: - case TARGET_UNIT_SRC_AREA_ENTRY: - case TARGET_UNIT_CONE_ENTRY: // fix me - radius = m_spellInfo->Effects[i].CalcRadius(); - targetType = SPELL_TARGETS_ENTRY; - break; - case TARGET_GAMEOBJECT_SRC_AREA: - case TARGET_GAMEOBJECT_DEST_AREA: - case TARGET_GAMEOBJECT_CONE: - radius = m_spellInfo->Effects[i].CalcRadius(); - targetType = SPELL_TARGETS_GO; - break; - default: - radius = m_spellInfo->Effects[i].CalcRadius(); - targetType = SPELL_TARGETS_NONE; - break; + m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK); + if (unitTarget->ToCreature()->IsAIEnabled) + unitTarget->ToCreature()->AI()->AttackStart(m_caster); + } + } + + if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && !m_spellInfo->IsPositive()) + { + m_caster->CombatStart(unit, !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO)); + + if (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_AURA_CC) + if (!unit->IsStandState()) + unit->SetStandState(UNIT_STAND_STATE_STAND); + } + + if (spellHitTarget) + { + //AI functions + if (spellHitTarget->GetTypeId() == TYPEID_UNIT) + { + if (spellHitTarget->ToCreature()->IsAIEnabled) + spellHitTarget->ToCreature()->AI()->SpellHit(m_caster, m_spellInfo); + + // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) + // ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm...) + if (m_originalCaster && m_originalCaster->IsControlledByPlayer() && !spellHitTarget->ToCreature()->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive()) + if (Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself()) + p->CastedCreatureOrGO(spellHitTarget->GetEntry(), spellHitTarget->GetGUID(), m_spellInfo->Id); } - if (modOwner) - modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius, this); - radius *= m_spellValue->RadiusMod; + if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsAIEnabled) + m_caster->ToCreature()->AI()->SpellHitTarget(spellHitTarget, m_spellInfo); + + // Needs to be called after dealing damage/healing to not remove breaking on damage auras + DoTriggersOnSpellHit(spellHitTarget, mask); + + // if target is fallged for pvp also flag caster if a player + if (unit->IsPvP() && m_caster->GetTypeId() == TYPEID_PLAYER) + m_caster->ToPlayer()->UpdatePvP(true); + + CallScriptAfterHitHandlers(); + } +} + +SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleAura) +{ + if (!unit || !effectMask) + return SPELL_MISS_EVADE; - std::list unitList; - std::list gobjectList; - switch (targetType) + // For delayed spells immunity may be applied between missile launch and hit - check immunity for that case + // disable effects to which unit is immune + for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber) + if (effectMask & (1 << effectNumber) && unit->IsImmunedToSpellEffect(m_spellInfo, effectNumber)) + effectMask &= ~(1 << effectNumber); + if (!effectMask || (m_spellInfo->Speed && (unit->IsImmunedToDamage(m_spellInfo) || unit->IsImmunedToSpell(m_spellInfo)))) + return SPELL_MISS_IMMUNE; + + PrepareScriptHitHandlers(); + CallScriptBeforeHitHandlers(); + + if (unit->GetTypeId() == TYPEID_PLAYER) + { + unit->ToPlayer()->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, m_spellInfo->Id); + unit->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, m_spellInfo->Id, 0, m_caster); + unit->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, m_spellInfo->Id); + } + + if (m_caster->GetTypeId() == TYPEID_PLAYER) + { + m_caster->ToPlayer()->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_CASTER, m_spellInfo->Id); + m_caster->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, m_spellInfo->Id, 0, unit); + } + + if (m_caster != unit) + { + // Recheck UNIT_FLAG_NON_ATTACKABLE for delayed spells + if (m_spellInfo->Speed > 0.0f && unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID()) + return SPELL_MISS_EVADE; + + if (m_caster->_IsValidAttackTarget(unit, m_spellInfo)) + { + unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL); + //TODO: This is a hack. But we do not know what types of stealth should be interrupted by CC + if ((m_spellInfo->AttributesCu & SPELL_ATTR0_CU_AURA_CC) && unit->IsControlledByPlayer()) + unit->RemoveAurasByType(SPELL_AURA_MOD_STEALTH); + } + else if (m_caster->IsFriendlyTo(unit)) { - case SPELL_TARGETS_ENTRY: + // for delayed spells ignore negative spells (after duel end) for friendly targets + // TODO: this cause soul transfer bugged + if (m_spellInfo->Speed > 0.0f && unit->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->IsPositive()) + return SPELL_MISS_EVADE; + + // assisting case, healing and resurrection + if (unit->HasUnitState(UNIT_STATE_ATTACK_PLAYER)) { - ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET, m_spellInfo->Id); - if (!conditions.empty()) - { - for (ConditionList::const_iterator i_spellST = conditions.begin(); i_spellST != conditions.end(); ++i_spellST) - { - if ((*i_spellST)->ConditionType != CONDITION_SPELL_SCRIPT_TARGET) - continue; - if ((*i_spellST)->ConditionValue3 && !((*i_spellST)->ConditionValue3 & effectMask)) - continue; - if ((*i_spellST)->ConditionValue1 == SPELL_TARGET_TYPE_CREATURE) - SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENTRY, (*i_spellST)->ConditionValue2); - else if ((*i_spellST)->ConditionValue1 == SPELL_TARGET_TYPE_CONTROLLED) - { - for (Unit::ControlList::iterator itr = m_caster->m_Controlled.begin(); itr != m_caster->m_Controlled.end(); ++itr) - if ((*itr)->GetEntry() == (*i_spellST)->ConditionValue2 && - (*itr)->IsInMap(m_caster)) // For 60243 and 52173 need skip radius check or use range (no radius entry for effect) - unitList.push_back(*itr); - } - } - } - else - { - // Custom entries - // TODO: move these to sql - switch (m_spellInfo->Id) - { - case 46584: // Raise Dead - { - if (WorldObject* result = FindCorpseUsing()) - { - switch (result->GetTypeId()) - { - case TYPEID_UNIT: - case TYPEID_PLAYER: - unitList.push_back(result->ToUnit()); - // no break; - case TYPEID_CORPSE: // wont work until corpses are allowed in target lists, but at least will send dest in packet - m_targets.SetDst(*result); - break; - default: - break; - } - } - break; - } - // Corpse Explosion - case 49158: - case 51325: - case 51326: - case 51327: - case 51328: - // Search for ghoul if our ghoul or dead body not valid unit target - if (!(m_targets.GetUnitTarget() && ((m_targets.GetUnitTarget()->GetEntry() == 26125 && m_targets.GetUnitTarget()->GetOwnerGUID() == m_caster->GetGUID()) - || (m_targets.GetUnitTarget()->getDeathState() == CORPSE - && m_targets.GetUnitTarget()->GetTypeId() == TYPEID_UNIT - && !(m_targets.GetUnitTarget()->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL) - && m_targets.GetUnitTarget()->GetDisplayId() == m_targets.GetUnitTarget()->GetNativeDisplayId())))) - { - CleanupTargetList(); - - WorldObject* result = FindCorpseUsing(); - - if (result) - { - switch (result->GetTypeId()) - { - case TYPEID_UNIT: - case TYPEID_PLAYER: - m_targets.SetUnitTarget((Unit*)result); - break; - default: - break; - } - } - else - { - if (m_caster->GetTypeId() == TYPEID_PLAYER) - m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true); - SendCastResult(SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW); - finish(false); - } - } - break; + m_caster->SetContestedPvP(); + if (m_caster->GetTypeId() == TYPEID_PLAYER) + m_caster->ToPlayer()->UpdatePvP(true); + } + if (unit->isInCombat() && !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO)) + { + m_caster->SetInCombatState(unit->GetCombatTimer() > 0, unit); + unit->getHostileRefManager().threatAssist(m_caster, 0.0f); + } + } + } - default: - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell (ID: %u) (caster Entry: %u) does not have type CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET record in `conditions` table.", m_spellInfo->Id, m_caster->GetEntry()); + // Get Data Needed for Diminishing Returns, some effects may have multiple auras, so this must be done on spell hit, not aura add + m_diminishGroup = GetDiminishingReturnsGroupForSpell(m_spellInfo, m_triggeredByAuraSpell); + if (m_diminishGroup) + { + m_diminishLevel = unit->GetDiminishing(m_diminishGroup); + DiminishingReturnsType type = GetDiminishingReturnsGroupType(m_diminishGroup); + // Increase Diminishing on unit, current informations for actually casts will use values above + if ((type == DRTYPE_PLAYER && unit->GetCharmerOrOwnerPlayerOrPlayerItself()) || type == DRTYPE_ALL) + unit->IncrDiminishing(m_diminishGroup); + } - if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_TELEPORT_UNITS) - SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENTRY, 0); - else if (m_spellInfo->IsPositiveEffect(i)) - SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ALLY); - else - SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENEMY); - } + uint8 aura_effmask = 0; + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (effectMask & (1 << i) && m_spellInfo->Effects[i].IsUnitOwnedAuraEffect()) + aura_effmask |= 1 << i; + + if (aura_effmask) + { + // Select rank for aura with level requirements only in specific cases + // Unit has to be target only of aura effect, both caster and target have to be players, target has to be other than unit target + SpellInfo const* aurSpellInfo = m_spellInfo; + int32 basePoints[3]; + if (scaleAura) + { + aurSpellInfo = m_spellInfo->GetAuraRankForLevel(unitTarget->getLevel()); + ASSERT(aurSpellInfo); + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + basePoints[i] = aurSpellInfo->Effects[i].BasePoints; + if (m_spellInfo->Effects[i].Effect != aurSpellInfo->Effects[i].Effect) + { + aurSpellInfo = m_spellInfo; + break; } - break; } - case SPELL_TARGETS_GO: + } + + if (m_originalCaster) + { + bool refresh = false; + m_spellAura = Aura::TryRefreshStackOrCreate(aurSpellInfo, effectMask, unit, + m_originalCaster, (aurSpellInfo == m_spellInfo)? &m_spellValue->EffectBasePoints[0] : &basePoints[0], m_CastItem, 0, &refresh); + if (m_spellAura) { - ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET, m_spellInfo->Id); - if (!conditions.empty()) + // Set aura stack amount to desired value + if (m_spellValue->AuraStackAmount > 1) { - for (ConditionList::const_iterator i_spellST = conditions.begin(); i_spellST != conditions.end(); ++i_spellST) - { - if ((*i_spellST)->ConditionType != CONDITION_SPELL_SCRIPT_TARGET) - continue; - if ((*i_spellST)->ConditionValue3 && !((*i_spellST)->ConditionValue3 & effectMask)) - continue; - if ((*i_spellST)->ConditionValue1 == SPELL_TARGET_TYPE_GAMEOBJECT) - SearchGOAreaTarget(gobjectList, radius, pushType, SPELL_TARGETS_GO, (*i_spellST)->ConditionValue2); - } + if (!refresh) + m_spellAura->SetStackAmount(m_spellValue->AuraStackAmount); + else + m_spellAura->ModStackAmount(m_spellValue->AuraStackAmount); } - else + + // Now Reduce spell duration using data received at spell hit + int32 duration = m_spellAura->GetMaxDuration(); + int32 limitduration = GetDiminishingReturnsLimitDuration(m_diminishGroup, aurSpellInfo); + float diminishMod = unit->ApplyDiminishingToDuration(m_diminishGroup, duration, m_originalCaster, m_diminishLevel, limitduration); + + // unit is immune to aura if it was diminished to 0 duration + if (diminishMod == 0.0f) { - if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_ACTIVATE_OBJECT) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell (ID: %u) (caster Entry: %u) with SPELL_EFFECT_ACTIVATE_OBJECT does not have type CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET record in `conditions` table.", m_spellInfo->Id, m_caster->GetEntry()); - SearchGOAreaTarget(gobjectList, radius, pushType, SPELL_TARGETS_GO); + m_spellAura->Remove(); + bool found = false; + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (effectMask & (1 << i) && m_spellInfo->Effects[i].Effect != SPELL_EFFECT_APPLY_AURA) + found = true; + if (!found) + return SPELL_MISS_IMMUNE; } - break; - } - case SPELL_TARGETS_ALLY: - case SPELL_TARGETS_ENEMY: - case SPELL_TARGETS_CHAINHEAL: - case SPELL_TARGETS_ANY: - SearchAreaTarget(unitList, radius, pushType, targetType); - break; - default: - switch (cur.GetTarget()) + else { - case TARGET_UNIT_SRC_AREA_PARTY: - case TARGET_UNIT_DEST_AREA_PARTY: - m_caster->GetPartyMemberInDist(unitList, radius); //fix me - break; - case TARGET_UNIT_LASTTARGET_AREA_PARTY: - m_targets.GetUnitTarget()->GetPartyMemberInDist(unitList, radius); - break; - case TARGET_UNIT_CASTER_AREA_PARTY: - m_caster->GetPartyMemberInDist(unitList, radius); - break; - case TARGET_UNIT_CASTER_AREA_RAID: - m_caster->GetRaidMember(unitList, radius); - break; - case TARGET_UNIT_TARGET_AREA_RAID_CLASS: + ((UnitAura*)m_spellAura)->SetDiminishGroup(m_diminishGroup); + + bool positive = m_spellAura->GetSpellInfo()->IsPositive(); + if (AuraApplication* aurApp = m_spellAura->GetApplicationOfTarget(m_originalCaster->GetGUID())) + positive = aurApp->IsPositive(); + + duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive, effectMask); + + // Haste modifies duration of channeled spells + if (m_spellInfo->IsChanneled()) { - Player* targetPlayer = m_targets.GetUnitTarget() && m_targets.GetUnitTarget()->GetTypeId() == TYPEID_PLAYER - ? (Player*)m_targets.GetUnitTarget() : NULL; + if (m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION) + m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this); + } + // and duration of auras affected by SPELL_AURA_PERIODIC_HASTE + else if (m_originalCaster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, aurSpellInfo) || m_spellInfo->AttributesEx5 & SPELL_ATTR5_HASTE_AFFECT_DURATION) + duration = int32(duration * m_originalCaster->GetFloatValue(UNIT_MOD_CAST_SPEED)); - Group* group = targetPlayer ? targetPlayer->GetGroup() : NULL; - if (group) - { - for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) - { - Player* Target = itr->getSource(); - - // IsHostileTo check duel and controlled by enemy - if (Target && targetPlayer->IsWithinDistInMap(Target, radius) && targetPlayer->getClass() == Target->getClass() && !m_caster->IsHostileTo(Target)) - AddUnitTarget(Target, effectMask); - } - } - else if (m_targets.GetUnitTarget()) - AddUnitTarget(m_targets.GetUnitTarget(), effectMask); - break; + if (duration != m_spellAura->GetMaxDuration()) + { + m_spellAura->SetMaxDuration(duration); + m_spellAura->SetDuration(duration); } - default: - break; + m_spellAura->_RegisterForTargets(); } - break; } + } + } - if (!unitList.empty()) + for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber) + if (effectMask & (1 << effectNumber)) + HandleEffects(unit, NULL, NULL, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET); + + return SPELL_MISS_NONE; +} + +void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask) +{ + // Apply additional spell effects to target + // TODO: move this code to scripts + if (m_preCastSpell) + { + // Paladin immunity shields + if (m_preCastSpell == 61988) { - // Special target selection for smart heals and energizes - uint32 maxSize = 0; - int32 power = -1; - switch (m_spellInfo->SpellFamilyName) - { - case SPELLFAMILY_GENERIC: - switch (m_spellInfo->Id) - { - case 52759: // Ancestral Awakening - case 71610: // Echoes of Light (Althor's Abacus normal version) - case 71641: // Echoes of Light (Althor's Abacus heroic version) - maxSize = 1; - power = POWER_HEALTH; - break; - case 54968: // Glyph of Holy Light - maxSize = m_spellInfo->MaxAffectedTargets; - power = POWER_HEALTH; - break; - case 57669: // Replenishment - // In arenas Replenishment may only affect the caster - if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->InArena()) - { - unitList.clear(); - unitList.push_back(m_caster); - break; - } - maxSize = 10; - power = POWER_MANA; - break; - default: - break; - } - break; - case SPELLFAMILY_PRIEST: - if (m_spellInfo->SpellFamilyFlags[0] == 0x10000000) // Circle of Healing - { - maxSize = m_caster->HasAura(55675) ? 6 : 5; // Glyph of Circle of Healing - power = POWER_HEALTH; - } - else if (m_spellInfo->Id == 64844) // Divine Hymn - { - maxSize = 3; - power = POWER_HEALTH; - } - else if (m_spellInfo->Id == 64904) // Hymn of Hope - { - maxSize = 3; - power = POWER_MANA; - } - else - break; + // Cast Forbearance + m_caster->CastSpell(unit, 25771, true); + // Cast Avenging Wrath Marker + unit->CastSpell(unit, 61987, true); + } - // Remove targets outside caster's raid - for (std::list::iterator itr = unitList.begin() ; itr != unitList.end();) - { - if (!(*itr)->IsInRaidWith(m_caster)) - itr = unitList.erase(itr); - else - ++itr; - } - break; - case SPELLFAMILY_DRUID: - if (m_spellInfo->SpellFamilyFlags[1] == 0x04000000) // Wild Growth - { - maxSize = m_caster->HasAura(62970) ? 6 : 5; // Glyph of Wild Growth - power = POWER_HEALTH; - } - else if (m_spellInfo->SpellFamilyFlags[2] == 0x0100) // Starfall - { - // Remove targets not in LoS or in stealth - for (std::list::iterator itr = unitList.begin() ; itr != unitList.end();) - { - if ((*itr)->HasStealthAura() || (*itr)->HasInvisibilityAura() || !(*itr)->IsWithinLOSInMap(m_caster)) - itr = unitList.erase(itr); - else - ++itr; - } - break; - } - else - break; + // Avenging Wrath + if (m_preCastSpell == 61987) + // Cast the serverside immunity shield marker + m_caster->CastSpell(unit, 61988, true); - // Remove targets outside caster's raid - for (std::list::iterator itr = unitList.begin() ; itr != unitList.end();) - if (!(*itr)->IsInRaidWith(m_caster)) - itr = unitList.erase(itr); - else - ++itr; - break; - default: - break; - } + if (sSpellMgr->GetSpellInfo(m_preCastSpell)) + // Blizz seems to just apply aura without bothering to cast + m_caster->AddAura(m_preCastSpell, unit); + } - if (maxSize && power != -1) + // handle SPELL_AURA_ADD_TARGET_TRIGGER auras + // this is executed after spell proc spells on target hit + // spells are triggered for each hit spell target + // info confirmed with retail sniffs of permafrost and shadow weaving + if (!m_hitTriggerSpells.empty()) + { + int _duration = 0; + for (HitTriggerSpells::const_iterator i = m_hitTriggerSpells.begin(); i != m_hitTriggerSpells.end(); ++i) + { + if (CanExecuteTriggersOnHit(effMask, i->first) && roll_chance_i(i->second)) { - if (Powers(power) == POWER_HEALTH) - { - if (unitList.size() > maxSize) - { - unitList.sort(Trinity::HealthPctOrderPred()); - unitList.resize(maxSize); - } - } - else - { - for (std::list::iterator itr = unitList.begin() ; itr != unitList.end();) - if ((*itr)->getPowerType() != (Powers)power) - itr = unitList.erase(itr); - else - ++itr; + m_caster->CastSpell(unit, i->first, true); + sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->first->Id); - if (unitList.size() > maxSize) + // SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration + // set duration of current aura to the triggered spell + if (i->first->GetDuration() == -1) + { + if (Aura* triggeredAur = unit->GetAura(i->first->Id, m_caster->GetGUID())) { - unitList.sort(Trinity::PowerPctOrderPred((Powers)power)); - unitList.resize(maxSize); + // get duration from aura-only once + if (!_duration) + { + Aura* aur = unit->GetAura(m_spellInfo->Id, m_caster->GetGUID()); + _duration = aur ? aur->GetDuration() : -1; + } + triggeredAur->SetDuration(_duration); } } } + } + } - // Other special target selection goes here - if (uint32 maxTargets = m_spellValue->MaxAffectedTargets) + // trigger linked auras remove/apply + // TODO: remove/cleanup this, as this table is not documented and people are doing stupid things with it + if (std::vector const* spellTriggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id + SPELL_LINK_HIT)) + for (std::vector::const_iterator i = spellTriggered->begin(); i != spellTriggered->end(); ++i) + if (*i < 0) + unit->RemoveAurasDueToSpell(-(*i)); + else + unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID()); +} + +void Spell::DoAllEffectOnTarget(GOTargetInfo* target) +{ + if (target->processed) // Check target + return; + target->processed = true; // Target checked in apply effects procedure + + uint32 effectMask = target->effectMask; + if (!effectMask) + return; + + GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID); + if (!go) + return; + + PrepareScriptHitHandlers(); + CallScriptBeforeHitHandlers(); + + for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber) + if (effectMask & (1 << effectNumber)) + HandleEffects(NULL, NULL, go, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET); + + CallScriptOnHitHandlers(); + + // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) + // ignore autorepeat/melee casts for speed (not exist quest for spells (hm...) + if (m_originalCaster && m_originalCaster->IsControlledByPlayer() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive()) + if (Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself()) + p->CastedCreatureOrGO(go->GetEntry(), go->GetGUID(), m_spellInfo->Id); + CallScriptAfterHitHandlers(); +} + +void Spell::DoAllEffectOnTarget(ItemTargetInfo* target) +{ + uint32 effectMask = target->effectMask; + if (!target->item || !effectMask) + return; + + PrepareScriptHitHandlers(); + CallScriptBeforeHitHandlers(); + + for (uint32 effectNumber = 0; effectNumber < MAX_SPELL_EFFECTS; ++effectNumber) + if (effectMask & (1 << effectNumber)) + HandleEffects(NULL, target->item, NULL, effectNumber, SPELL_EFFECT_HANDLE_HIT_TARGET); + + CallScriptOnHitHandlers(); + + CallScriptAfterHitHandlers(); +} + +bool Spell::UpdateChanneledTargetList() +{ + // Not need check return true + if (m_channelTargetEffectMask == 0) + return true; + + uint8 channelTargetEffectMask = m_channelTargetEffectMask; + uint8 channelAuraMask = 0; + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_APPLY_AURA) + channelAuraMask |= 1<GetMaxRange(m_spellInfo->IsPositive()); + if (Player* modOwner = m_caster->GetSpellModOwner()) + modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this); + } + + for (std::list::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + { + if (ihit->missCondition == SPELL_MISS_NONE && (channelTargetEffectMask & ihit->effectMask)) + { + Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); + + if (!unit) + continue; + + if (IsValidDeadOrAliveTarget(unit)) { - Unit::AuraEffectList const& Auras = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_MAX_AFFECTED_TARGETS); - for (Unit::AuraEffectList::const_iterator j = Auras.begin(); j != Auras.end(); ++j) - if ((*j)->IsAffectedOnSpell(m_spellInfo)) - maxTargets += (*j)->GetAmount(); + if (channelAuraMask & ihit->effectMask) + { + if (AuraApplication * aurApp = unit->GetAuraApplication(m_spellInfo->Id, m_originalCasterGUID)) + { + if (m_caster != unit && !m_caster->IsWithinDistInMap(unit, range)) + { + ihit->effectMask &= ~aurApp->GetEffectMask(); + unit->RemoveAura(aurApp); + continue; + } + } + else // aura is dispelled + continue; + } - if (m_spellInfo->Id == 5246) //Intimidating Shout - unitList.remove(m_targets.GetUnitTarget()); - Trinity::RandomResizeList(unitList, maxTargets); + channelTargetEffectMask &= ~ihit->effectMask; // remove from need alive mask effect that have alive target } + } + } - CallScriptAfterUnitTargetSelectHandlers(unitList, SpellEffIndex(i)); + // is all effects from m_needAliveTargetMask have alive targets + return channelTargetEffectMask == 0; +} - for (std::list::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - AddUnitTarget(*itr, effectMask, false); - } +// Helper for Chain Healing +// Spell target first +// Raidmates then descending by injury suffered (MaxHealth - Health) +// Other players/mobs then descending by injury suffered (MaxHealth - Health) +struct ChainHealingOrder : public std::binary_function +{ + const Unit* MainTarget; + ChainHealingOrder(Unit const* Target) : MainTarget(Target) {}; + // functor for operator ">" + bool operator()(Unit const* _Left, Unit const* _Right) const + { + return (ChainHealingHash(_Left) < ChainHealingHash(_Right)); + } - if (!gobjectList.empty()) + int32 ChainHealingHash(Unit const* Target) const + { + if (Target->GetTypeId() == TYPEID_PLAYER && MainTarget->GetTypeId() == TYPEID_PLAYER && Target->ToPlayer()->IsInSameRaidWith(MainTarget->ToPlayer())) { - if (uint32 maxTargets = m_spellValue->MaxAffectedTargets) - { - Unit::AuraEffectList const& Auras = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_MAX_AFFECTED_TARGETS); - for (Unit::AuraEffectList::const_iterator j = Auras.begin(); j != Auras.end(); ++j) - if ((*j)->IsAffectedOnSpell(m_spellInfo)) - maxTargets += (*j)->GetAmount(); - - Trinity::RandomResizeList(gobjectList, maxTargets); - } - for (std::list::iterator itr = gobjectList.begin(); itr != gobjectList.end(); ++itr) - AddGOTarget(*itr, effectMask); + if (Target->IsFullHealth()) + return 40000; + else + return 20000 - Target->GetMaxHealth() + Target->GetHealth(); } + else + return 40000 - Target->GetMaxHealth() + Target->GetHealth(); } - - return effectMask; -} +}; void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura) { @@ -6847,150 +6854,6 @@ void Spell::SetSpellValue(SpellValueMod mod, int32 value) } } -float tangent(float x) -{ - x = tan(x); - //if (x < std::numeric_limits::max() && x > -std::numeric_limits::max()) return x; - //if (x >= std::numeric_limits::max()) return std::numeric_limits::max(); - //if (x <= -std::numeric_limits::max()) return -std::numeric_limits::max(); - if (x < 100000.0f && x > -100000.0f) return x; - if (x >= 100000.0f) return 100000.0f; - if (x <= 100000.0f) return -100000.0f; - return 0.0f; -} - -#define DEBUG_TRAJ(a) //a - -void Spell::SelectTrajTargets() -{ - if (!m_targets.HasTraj()) - return; - - float dist2d = m_targets.GetDist2d(); - if (!dist2d) - return; - - float srcToDestDelta = m_targets.GetDst()->m_positionZ - m_targets.GetSrc()->m_positionZ; - - UnitList unitList; - SearchAreaTarget(unitList, dist2d, PUSH_IN_THIN_LINE, SPELL_TARGETS_ANY); - if (unitList.empty()) - return; - - unitList.sort(Trinity::ObjectDistanceOrderPred(m_caster)); - - float b = tangent(m_targets.GetElevation()); - float a = (srcToDestDelta - dist2d * b) / (dist2d * dist2d); - if (a > -0.0001f) - a = 0; - DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: a %f b %f", a, b);) - - float bestDist = m_spellInfo->GetMaxRange(false); - - UnitList::const_iterator itr = unitList.begin(); - for (; itr != unitList.end(); ++itr) - { - if (m_caster == *itr || m_caster->IsOnVehicle(*itr) || (*itr)->GetVehicle())//(*itr)->IsOnVehicle(m_caster)) - continue; - - const float size = std::max((*itr)->GetObjectSize() * 0.7f, 1.0f); // 1/sqrt(3) - // TODO: all calculation should be based on src instead of m_caster - const float objDist2d = m_targets.GetSrc()->GetExactDist2d(*itr) * cos(m_targets.GetSrc()->GetRelativeAngle(*itr)); - const float dz = (*itr)->GetPositionZ() - m_targets.GetSrc()->m_positionZ; - - DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);) - - float dist = objDist2d - size; - float height = dist * (a * dist + b); - DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);) - if (dist < bestDist && height < dz + size && height > dz - size) - { - bestDist = dist > 0 ? dist : 0; - break; - } - -#define CHECK_DIST {\ - DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\ - if (dist > bestDist)\ - continue;\ - if (dist < objDist2d + size && dist > objDist2d - size)\ - {\ - bestDist = dist;\ - break;\ - }\ - } - - if (!a) - { - height = dz - size; - dist = height / b; - CHECK_DIST; - - height = dz + size; - dist = height / b; - CHECK_DIST; - - continue; - } - - height = dz - size; - float sqrt1 = b * b + 4 * a * height; - if (sqrt1 > 0) - { - sqrt1 = sqrt(sqrt1); - dist = (sqrt1 - b) / (2 * a); - CHECK_DIST; - } - - height = dz + size; - float sqrt2 = b * b + 4 * a * height; - if (sqrt2 > 0) - { - sqrt2 = sqrt(sqrt2); - dist = (sqrt2 - b) / (2 * a); - CHECK_DIST; - - dist = (-sqrt2 - b) / (2 * a); - CHECK_DIST; - } - - if (sqrt1 > 0) - { - dist = (-sqrt1 - b) / (2 * a); - CHECK_DIST; - } - } - - if (m_targets.GetSrc()->GetExactDist2d(m_targets.GetDst()) > bestDist) - { - float x = m_targets.GetSrc()->m_positionX + cos(m_caster->GetOrientation()) * bestDist; - float y = m_targets.GetSrc()->m_positionY + sin(m_caster->GetOrientation()) * bestDist; - float z = m_targets.GetSrc()->m_positionZ + bestDist * (a * bestDist + b); - - if (itr != unitList.end()) - { - float distSq = (*itr)->GetExactDistSq(x, y, z); - float sizeSq = (*itr)->GetObjectSize(); - sizeSq *= sizeSq; - DEBUG_TRAJ(sLog->outError("Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) - if (distSq > sizeSq) - { - float factor = 1 - sqrt(sizeSq / distSq); - x += factor * ((*itr)->GetPositionX() - x); - y += factor * ((*itr)->GetPositionY() - y); - z += factor * ((*itr)->GetPositionZ() - z); - - distSq = (*itr)->GetExactDistSq(x, y, z); - DEBUG_TRAJ(sLog->outError("Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) - } - } - - Position trajDst; - trajDst.Relocate(x, y, z, m_caster->GetOrientation()); - m_targets.ModDst(trajDst); - } -} - void Spell::PrepareTargetProcessing() { CheckEffectExecuteData(); @@ -7342,3 +7205,152 @@ void Spell::CancelGlobalCooldown() else if (m_caster->GetTypeId() == TYPEID_PLAYER) m_caster->ToPlayer()->GetGlobalCooldownMgr().CancelGlobalCooldown(m_spellInfo); } + +namespace Trinity +{ + +WorldObjectSpellTargetCheck::WorldObjectSpellTargetCheck(Unit* caster, Unit* referer, SpellInfo const* spellInfo, + SpellTargetCheckTypes selectionType, ConditionList* condList) : _caster(caster), _referer(referer), _spellInfo(spellInfo), + _condList(condList), _targetSelectionType(selectionType) +{ + if (condList) + _condSrcInfo = new ConditionSourceInfo(NULL, caster); + else + _condSrcInfo = NULL; +} + +WorldObjectSpellTargetCheck::~WorldObjectSpellTargetCheck() +{ + if (_condSrcInfo) + delete _condSrcInfo; +} + +bool WorldObjectSpellTargetCheck::operator()(WorldObject* target) +{ + if (_spellInfo->CheckTarget(_caster, target, true) != SPELL_CAST_OK) + return false; + Unit* unitTarget = target->ToUnit(); + if (Corpse* corpseTarget = target->ToCorpse()) + { + // use ofter for party/assistance checks + if (Player* owner = ObjectAccessor::FindPlayer(corpseTarget->GetOwnerGUID())) + unitTarget = owner; + else + return false; + } + if (unitTarget) + { + switch (_targetSelectionType) + { + case TARGET_CHECK_ENEMY: + if (unitTarget->isTotem()) + return false; + if (!_caster->_IsValidAttackTarget(unitTarget, _spellInfo)) + return false; + break; + case TARGET_CHECK_ALLY: + if (unitTarget->isTotem()) + return false; + if (!_caster->_IsValidAssistTarget(unitTarget, _spellInfo)) + return false; + break; + case TARGET_CHECK_PARTY: + if (unitTarget->isTotem()) + return false; + if (!_caster->_IsValidAssistTarget(unitTarget, _spellInfo)) + return false; + if (!_referer->IsInPartyWith(unitTarget)) + return false; + break; + case TARGET_CHECK_RAID_CLASS: + if (_referer->getClass() != unitTarget->getClass()) + return false; + // nobreak; + case TARGET_CHECK_RAID: + if (unitTarget->isTotem()) + return false; + if (!_caster->_IsValidAssistTarget(unitTarget, _spellInfo)) + return false; + if (!_referer->IsInRaidWith(unitTarget)) + return false; + break; + default: + break; + } + } + if (!_condSrcInfo) + return true; + _condSrcInfo->mConditionTargets[0] = target; + return sConditionMgr->IsObjectMeetToConditions(*_condSrcInfo, *_condList); +} + +WorldObjectSpellNearbyTargetCheck::WorldObjectSpellNearbyTargetCheck(float range, Unit* caster, SpellInfo const* spellInfo, + SpellTargetCheckTypes selectionType, ConditionList* condList) + : WorldObjectSpellTargetCheck(caster, caster, spellInfo, selectionType, condList), _range(range), _position(caster) +{ +} + +bool WorldObjectSpellNearbyTargetCheck::operator()(WorldObject* target) +{ + float dist = target->GetDistance(*_position); + if (dist < _range && WorldObjectSpellTargetCheck::operator ()(target)) + { + _range = dist; + return true; + } + return false; +} + +WorldObjectSpellAreaTargetCheck::WorldObjectSpellAreaTargetCheck(float range, Position const* position, Unit* caster, + Unit* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList) + : WorldObjectSpellTargetCheck(caster, referer, spellInfo, selectionType, condList), _range(range), _position(position) +{ +} + +bool WorldObjectSpellAreaTargetCheck::operator()(WorldObject* target) +{ + if (!target->IsWithinDist3d(_position, _range)) + return false; + return WorldObjectSpellTargetCheck::operator ()(target); +} + +WorldObjectSpellConeTargetCheck::WorldObjectSpellConeTargetCheck(float coneAngle, float range, Unit* caster, + SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList) + : WorldObjectSpellAreaTargetCheck(range, caster, caster, caster, spellInfo, selectionType, condList), _coneAngle(coneAngle) +{ +} + +bool WorldObjectSpellConeTargetCheck::operator()(WorldObject* target) +{ + if (_spellInfo->AttributesCu & SPELL_ATTR0_CU_CONE_BACK) + { + if (!_caster->isInBack(target, _coneAngle)) + return false; + } + else if (_spellInfo->AttributesCu & SPELL_ATTR0_CU_CONE_LINE) + { + if (!_caster->HasInLine(target, _caster->GetObjectSize())) + return false; + } + else + { + if (!_caster->isInFront(target, _coneAngle)) + return false; + } + return WorldObjectSpellAreaTargetCheck::operator ()(target); +} + +WorldObjectSpellTrajTargetCheck::WorldObjectSpellTrajTargetCheck(float range, Position const* position, Unit* caster, SpellInfo const* spellInfo) + : WorldObjectSpellAreaTargetCheck(range, position, caster, caster, spellInfo, TARGET_CHECK_DEFAULT, NULL) +{ +} + +bool WorldObjectSpellTrajTargetCheck::operator()(WorldObject* target) +{ + // return all targets on missile trajectory (0 - size of a missile) + if (!_caster->HasInLine(target, 0)) + return false; + return WorldObjectSpellAreaTargetCheck::operator ()(target); +} + +} //namespace Trinity diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 583123eb261..5e7c3a94737 100755 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -79,19 +79,6 @@ enum SpellRangeFlag SPELL_RANGE_RANGED = 2, //hunter range and ranged weapon }; -enum SpellNotifyPushType -{ - PUSH_NONE = 0, - PUSH_IN_FRONT, - PUSH_IN_BACK, - PUSH_IN_LINE, - PUSH_IN_THIN_LINE, - PUSH_SRC_CENTER, - PUSH_DST_CENTER, - PUSH_CASTER_CENTER, //this is never used in grid search - PUSH_CHAIN, -}; - class SpellCastTargets { public: @@ -210,17 +197,6 @@ enum SpellEffectHandleMode SPELL_EFFECT_HANDLE_HIT_TARGET, }; -enum SpellTargets -{ - SPELL_TARGETS_NONE = 0, - SPELL_TARGETS_ALLY, - SPELL_TARGETS_ENEMY, - SPELL_TARGETS_ENTRY, - SPELL_TARGETS_CHAINHEAL, - SPELL_TARGETS_ANY, - SPELL_TARGETS_GO -}; - namespace Trinity { struct SpellNotifierCreatureAndPlayer; @@ -228,7 +204,6 @@ namespace Trinity class Spell { - friend struct Trinity::SpellNotifierCreatureAndPlayer; friend void Unit::SetCurrentCastedSpell(Spell* pSpell); friend class SpellScript; public: @@ -364,6 +339,32 @@ class Spell Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID = 0, bool skipCheck = false); ~Spell(); + void InitExplicitTargets(SpellCastTargets const& targets); + void SelectExplicitTargets(); + + void SelectSpellTargets(); + void SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32& processedEffectMask); + void SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType); + void SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask); + void SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask); + void SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask); + void SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType); + void SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType); + void SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType); + void SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType); + void SelectImplicitTargetObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType); + void SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, WorldObject* target, uint32 effMask); + void SelectImplicitTrajTargets(); + + void SelectEffectTypeImplicitTargets(uint8 effIndex); + + uint32 GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionList* condList); + template void SearchTargets(SEARCHER& searcher, uint32 containerMask, Unit* referer, Position const* pos, float radius); + + WorldObject* SearchNearbyTarget(float range, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList = NULL); + void SearchAreaTargets(std::list& targets, float range, Position const* position, Unit* referer, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList); + void SearchChainTargets(std::list& targets, uint32 chainTargets, WorldObject* target, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectType, ConditionList* condList, bool isChainHeal); + void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = NULL); void cancel(); void update(uint32 difftime); @@ -404,15 +405,6 @@ class Spell void WriteSpellGoTargets(WorldPacket* data); void WriteAmmoToPacket(WorldPacket* data); - void InitExplicitTargets(SpellCastTargets const& targets); - void SelectExplicitTargets(); - void SelectSpellTargets(); - void SelectEffectTypeImplicitTargets(uint8 effIndex); - uint32 SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur); - void SelectTrajTargets(); - - template WorldObject* FindCorpseUsing(); - bool CheckEffectTarget(Unit const* target, uint32 eff) const; bool CanAutoCast(Unit* target); void CheckSrc() { if (!m_targets.HasSrc()) m_targets.SetSrc(*m_caster); } @@ -607,10 +599,6 @@ class Spell void DoAllEffectOnTarget(GOTargetInfo* target); void DoAllEffectOnTarget(ItemTargetInfo* target); bool UpdateChanneledTargetList(); - void SearchAreaTarget(std::list &unitList, float radius, SpellNotifyPushType type, SpellTargets TargetType, uint32 entry = 0); - void SearchGOAreaTarget(std::list &gobjectList, float radius, SpellNotifyPushType type, SpellTargets TargetType, uint32 entry = 0); - void SearchChainTarget(std::list &unitList, float radius, uint32 unMaxTargets, SpellTargets TargetType); - WorldObject* SearchNearbyTarget(float range, SpellTargets TargetType, SpellEffIndex effIndex); bool IsValidDeadOrAliveTarget(Unit const* target) const; void HandleLaunchPhase(); void DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier); @@ -676,98 +664,52 @@ class Spell namespace Trinity { - struct SpellNotifierCreatureAndPlayer + struct WorldObjectSpellTargetCheck { - std::list *i_data; - SpellNotifyPushType i_push_type; - float i_radius; - SpellTargets i_TargetType; - const Unit* const i_source; - uint32 i_entry; - const Position* const i_pos; - SpellInfo const* i_spellProto; - - SpellNotifierCreatureAndPlayer(Unit* source, std::list &data, float radius, SpellNotifyPushType type, - SpellTargets TargetType = SPELL_TARGETS_ENEMY, const Position* pos = NULL, uint32 entry = 0, SpellInfo const* spellProto = NULL) - : i_data(&data), i_push_type(type), i_radius(radius), i_TargetType(TargetType), - i_source(source), i_entry(entry), i_pos(pos), i_spellProto(spellProto) - { - ASSERT(i_source); - } + Unit* _caster; + Unit* _referer; + SpellInfo const* _spellInfo; + SpellTargetCheckTypes _targetSelectionType; + ConditionSourceInfo* _condSrcInfo; + ConditionList* _condList; + + WorldObjectSpellTargetCheck(Unit* caster, Unit* referer, SpellInfo const* spellInfo, + SpellTargetCheckTypes selectionType, ConditionList* condList); + WorldObjectSpellTargetCheck::~WorldObjectSpellTargetCheck(); + bool operator()(WorldObject* target); + }; - template inline void Visit(GridRefManager& m) - { - for (typename GridRefManager::iterator itr = m.begin(); itr != m.end(); ++itr) - { - Unit* target = (Unit*)itr->getSource(); - - if (i_spellProto->CheckTarget(i_source, target, true) != SPELL_CAST_OK) - continue; - - switch (i_TargetType) - { - case SPELL_TARGETS_ENEMY: - if (target->isTotem()) - continue; - if (!i_source->_IsValidAttackTarget(target, i_spellProto)) - continue; - break; - case SPELL_TARGETS_ALLY: - if (target->isTotem()) - continue; - if (!i_source->_IsValidAssistTarget(target, i_spellProto)) - continue; - break; - case SPELL_TARGETS_ENTRY: - if (target->GetEntry()!= i_entry) - continue; - break; - case SPELL_TARGETS_ANY: - default: - break; - } - - switch (i_push_type) - { - case PUSH_SRC_CENTER: - case PUSH_DST_CENTER: - case PUSH_CHAIN: - default: - if (target->IsWithinDist3d(i_pos, i_radius)) - i_data->push_back(target); - break; - case PUSH_IN_FRONT: - if (i_source->isInFront(target, i_radius, static_cast(M_PI/2))) - i_data->push_back(target); - break; - case PUSH_IN_BACK: - if (i_source->isInBack(target, i_radius, static_cast(M_PI/2))) - i_data->push_back(target); - break; - case PUSH_IN_LINE: - if (i_source->HasInLine(target, i_radius, i_source->GetObjectSize())) - i_data->push_back(target); - break; - case PUSH_IN_THIN_LINE: // only traj - if (i_pos->HasInLine(target, i_radius, 0)) - i_data->push_back(target); - break; - } - } - } + struct WorldObjectSpellNearbyTargetCheck : public WorldObjectSpellTargetCheck + { + float _range; + Position const* _position; + WorldObjectSpellNearbyTargetCheck(float range, Unit* caster, SpellInfo const* spellInfo, + SpellTargetCheckTypes selectionType, ConditionList* condList); + bool operator()(WorldObject* target); + }; + + struct WorldObjectSpellAreaTargetCheck : public WorldObjectSpellTargetCheck + { + float _range; + Position const* _position; + WorldObjectSpellAreaTargetCheck(float range, Position const* position, Unit* caster, + Unit* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList); + bool operator()(WorldObject* target); + }; - #ifdef _WIN32 - template<> inline void Visit(CorpseMapType &) {} - template<> inline void Visit(GameObjectMapType &) {} - template<> inline void Visit(DynamicObjectMapType &) {} - #endif + struct WorldObjectSpellConeTargetCheck : public WorldObjectSpellAreaTargetCheck + { + float _coneAngle; + WorldObjectSpellConeTargetCheck(float coneAngle, float range, Unit* caster, + SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList); + bool operator()(WorldObject* target); }; - #ifndef _WIN32 - template<> inline void SpellNotifierCreatureAndPlayer::Visit(CorpseMapType&) {} - template<> inline void SpellNotifierCreatureAndPlayer::Visit(GameObjectMapType&) {} - template<> inline void SpellNotifierCreatureAndPlayer::Visit(DynamicObjectMapType&) {} - #endif + struct WorldObjectSpellTrajTargetCheck : public WorldObjectSpellAreaTargetCheck + { + WorldObjectSpellTrajTargetCheck(float range, Position const* position, Unit* caster, SpellInfo const* spellInfo); + bool operator()(WorldObject* target); + }; } typedef void(Spell::*pEffect)(SpellEffIndex effIndex); diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index ad465767ab0..6d5c802e64f 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -20,6 +20,7 @@ #include "SpellMgr.h" #include "Spell.h" #include "DBCStores.h" +#include "ConditionMgr.h" uint32 GetTargetFlagMask(SpellTargetObjectTypes objType) { @@ -80,7 +81,7 @@ SpellTargetObjectTypes SpellImplicitTargetInfo::GetObjectType() const return _data[_target].ObjectType; } -SpellTargetSelectionCheckTypes SpellImplicitTargetInfo::GetSelectionCheckType() const +SpellTargetCheckTypes SpellImplicitTargetInfo::GetCheckType() const { return _data[_target].SelectionCheckType; } @@ -158,23 +159,25 @@ uint32 SpellImplicitTargetInfo::GetExplicitTargetMask(bool& srcSet, bool& dstSet case TARGET_OBJECT_TYPE_UNIT_AND_DEST: case TARGET_OBJECT_TYPE_UNIT: case TARGET_OBJECT_TYPE_DEST: - switch (GetSelectionCheckType()) + switch (GetCheckType()) { - case TARGET_SELECT_CHECK_ENEMY: + case TARGET_CHECK_ENEMY: targetMask = TARGET_FLAG_UNIT_ENEMY; break; - case TARGET_SELECT_CHECK_ALLY: + case TARGET_CHECK_ALLY: targetMask = TARGET_FLAG_UNIT_ALLY; break; - case TARGET_SELECT_CHECK_PARTY: + case TARGET_CHECK_PARTY: targetMask = TARGET_FLAG_UNIT_PARTY; break; - case TARGET_SELECT_CHECK_RAID: + case TARGET_CHECK_RAID: targetMask = TARGET_FLAG_UNIT_RAID; break; - case TARGET_SELECT_CHECK_PASSENGER: + case TARGET_CHECK_PASSENGER: targetMask = TARGET_FLAG_UNIT_PASSENGER; break; + case TARGET_CHECK_RAID_CLASS: + // nobreak; default: targetMask = TARGET_FLAG_UNIT; break; @@ -344,117 +347,117 @@ SpellSelectTargetTypes SpellImplicitTargetInfo::Type[TOTAL_SPELL_TARGETS]; SpellImplicitTargetInfo::StaticData SpellImplicitTargetInfo::_data[TOTAL_SPELL_TARGETS] = { - {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 1 TARGET_UNIT_CASTER - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_SELECT_CHECK_ENEMY, TARGET_DIR_NONE}, // 2 TARGET_UNIT_NEARBY_ENEMY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_SELECT_CHECK_PARTY, TARGET_DIR_NONE}, // 3 TARGET_UNIT_NEARBY_PARTY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_SELECT_CHECK_ALLY, TARGET_DIR_NONE}, // 4 TARGET_UNIT_NEARBY_ALLY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 5 TARGET_UNIT_PET - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_ENEMY, TARGET_DIR_NONE}, // 6 TARGET_UNIT_TARGET_ENEMY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_SRC, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CHECK_ENTRY, TARGET_DIR_NONE}, // 7 TARGET_UNIT_SRC_AREA_ENTRY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CHECK_ENTRY, TARGET_DIR_NONE}, // 8 TARGET_UNIT_DEST_AREA_ENTRY - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 9 TARGET_DEST_HOME - {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 10 - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_SRC, TARGET_SELECT_CATEGORY_NYI, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 11 TARGET_UNIT_SRC_AREA_UNK_11 - {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 12 - {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 13 - {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 14 - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_SRC, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CHECK_ENEMY, TARGET_DIR_NONE}, // 15 TARGET_UNIT_SRC_AREA_ENEMY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CHECK_ENEMY, TARGET_DIR_NONE}, // 16 TARGET_UNIT_DEST_AREA_ENEMY - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 17 TARGET_DEST_DB - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 18 TARGET_DEST_CASTER - {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 19 - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CHECK_PARTY, TARGET_DIR_NONE}, // 20 TARGET_UNIT_CASTER_AREA_PARTY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_ALLY, TARGET_DIR_NONE}, // 21 TARGET_UNIT_TARGET_ALLY - {TARGET_OBJECT_TYPE_SRC, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 22 TARGET_SRC_CASTER - {TARGET_OBJECT_TYPE_GOBJ, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 23 TARGET_GAMEOBJECT_TARGET - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CONE, TARGET_SELECT_CHECK_ENEMY, TARGET_DIR_FRONT}, // 24 TARGET_UNIT_CONE_ENEMY_24 - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 25 TARGET_UNIT_TARGET_ANY - {TARGET_OBJECT_TYPE_GOBJ_ITEM, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 26 TARGET_GAMEOBJECT_ITEM_TARGET - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 27 TARGET_UNIT_MASTER - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_ENEMY, TARGET_DIR_NONE}, // 28 TARGET_DEST_DYNOBJ_ENEMY - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_ALLY, TARGET_DIR_NONE}, // 29 TARGET_DEST_DYNOBJ_ALLY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_SRC, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CHECK_ALLY, TARGET_DIR_NONE}, // 30 TARGET_UNIT_SRC_AREA_ALLY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CHECK_ALLY, TARGET_DIR_NONE}, // 31 TARGET_UNIT_DEST_AREA_ALLY - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_FRONT_LEFT}, // 32 TARGET_DEST_CASTER_SUMMON - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_SRC, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CHECK_PARTY, TARGET_DIR_NONE}, // 33 TARGET_UNIT_SRC_AREA_PARTY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CHECK_PARTY, TARGET_DIR_NONE}, // 34 TARGET_UNIT_DEST_AREA_PARTY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_PARTY, TARGET_DIR_NONE}, // 35 TARGET_UNIT_TARGET_PARTY - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NYI, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 36 TARGET_DEST_CASTER_UNK_36 - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_LAST, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CHECK_PARTY, TARGET_DIR_NONE}, // 37 TARGET_UNIT_LASTTARGET_AREA_PARTY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_SELECT_CHECK_ENTRY, TARGET_DIR_NONE}, // 38 TARGET_UNIT_NEARBY_ENTRY - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 39 TARGET_DEST_CASTER_FISHING - {TARGET_OBJECT_TYPE_GOBJ, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_SELECT_CHECK_ENTRY, TARGET_DIR_NONE}, // 40 TARGET_GAMEOBJECT_NEARBY_ENTRY - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_FRONT_RIGHT}, // 41 TARGET_DEST_CASTER_FRONT_RIGHT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_BACK_RIGHT}, // 42 TARGET_DEST_CASTER_BACK_RIGHT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_BACK_LEFT}, // 43 TARGET_DEST_CASTER_BACK_LEFT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_FRONT_LEFT}, // 44 TARGET_DEST_CASTER_FRONT_LEFT - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_ALLY, TARGET_DIR_NONE}, // 45 TARGET_UNIT_TARGET_CHAINHEAL_ALLY - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_SELECT_CHECK_ENTRY, TARGET_DIR_NONE}, // 46 TARGET_DEST_NEARBY_ENTRY - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_FRONT}, // 47 TARGET_DEST_CASTER_FRONT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_BACK}, // 48 TARGET_DEST_CASTER_BACK - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_RIGHT}, // 49 TARGET_DEST_CASTER_RIGHT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_LEFT}, // 50 TARGET_DEST_CASTER_LEFT - {TARGET_OBJECT_TYPE_GOBJ, TARGET_REFERENCE_TYPE_SRC, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 51 TARGET_GAMEOBJECT_SRC_AREA - {TARGET_OBJECT_TYPE_GOBJ, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 52 TARGET_GAMEOBJECT_DEST_AREA - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_ENEMY, TARGET_DIR_NONE}, // 53 TARGET_DEST_TARGET_ENEMY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CONE, TARGET_SELECT_CHECK_ENEMY, TARGET_DIR_FRONT}, // 54 TARGET_UNIT_CONE_ENEMY_54 - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 55 TARGET_DEST_CASTER_FRONT_LEAP - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CHECK_RAID, TARGET_DIR_NONE}, // 56 TARGET_UNIT_CASTER_AREA_RAID - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_RAID, TARGET_DIR_NONE}, // 57 TARGET_UNIT_TARGET_RAID - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_SELECT_CHECK_RAID, TARGET_DIR_NONE}, // 58 TARGET_UNIT_NEARBY_RAID - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CONE, TARGET_SELECT_CHECK_ALLY, TARGET_DIR_FRONT}, // 59 TARGET_UNIT_CONE_ALLY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CONE, TARGET_SELECT_CHECK_ENTRY, TARGET_DIR_FRONT}, // 60 TARGET_UNIT_CONE_ENTRY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_AREA, TARGET_SELECT_CHECK_RAID, TARGET_DIR_NONE}, // 61 TARGET_UNIT_TARGET_AREA_RAID_CLASS - {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 62 TARGET_UNK_62 - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 63 TARGET_DEST_TARGET_ANY - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_FRONT}, // 64 TARGET_DEST_TARGET_FRONT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_BACK}, // 65 TARGET_DEST_TARGET_BACK - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_RIGHT}, // 66 TARGET_DEST_TARGET_RIGHT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_LEFT}, // 67 TARGET_DEST_TARGET_LEFT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_FRONT_RIGHT}, // 68 TARGET_DEST_TARGET_FRONT_RIGHT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_BACK_RIGHT}, // 69 TARGET_DEST_TARGET_BACK_RIGHT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_BACK_LEFT}, // 70 TARGET_DEST_TARGET_BACK_LEFT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_FRONT_LEFT}, // 71 TARGET_DEST_TARGET_FRONT_LEFT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_RANDOM}, // 72 TARGET_DEST_CASTER_RANDOM - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_RANDOM}, // 73 TARGET_DEST_CASTER_RADIUS - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_RANDOM}, // 74 TARGET_DEST_TARGET_RANDOM - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_RANDOM}, // 75 TARGET_DEST_TARGET_RADIUS - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CHANNEL, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 76 TARGET_DEST_CHANNEL_TARGET - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CHANNEL, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 77 TARGET_UNIT_CHANNEL_TARGET - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_FRONT}, // 78 TARGET_DEST_DEST_FRONT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_BACK}, // 79 TARGET_DEST_DEST_BACK - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_RIGHT}, // 80 TARGET_DEST_DEST_RIGHT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_LEFT}, // 81 TARGET_DEST_DEST_LEFT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_FRONT_RIGHT}, // 82 TARGET_DEST_DEST_FRONT_RIGHT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_BACK_RIGHT}, // 83 TARGET_DEST_DEST_BACK_RIGHT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_BACK_LEFT}, // 84 TARGET_DEST_DEST_BACK_LEFT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_FRONT_LEFT}, // 85 TARGET_DEST_DEST_FRONT_LEFT - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_RANDOM}, // 86 TARGET_DEST_DEST_RANDOM - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 87 TARGET_DEST_DEST - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 88 TARGET_DEST_DYNOBJ_NONE - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 89 TARGET_DEST_TRAJ - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 90 TARGET_UNIT_TARGET_MINIPET - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_RANDOM}, // 91 TARGET_DEST_DEST_RADIUS - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 92 TARGET_UNIT_SUMMONER - {TARGET_OBJECT_TYPE_CORPSE, TARGET_REFERENCE_TYPE_SRC, TARGET_SELECT_CATEGORY_NYI, TARGET_SELECT_CHECK_ENEMY, TARGET_DIR_NONE}, // 93 TARGET_CORPSE_SRC_AREA_ENEMY - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 94 TARGET_UNIT_VEHICLE - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_PASSENGER, TARGET_DIR_NONE}, // 95 TARGET_UNIT_TARGET_PASSENGER - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 96 TARGET_UNIT_PASSENGER_0 - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 97 TARGET_UNIT_PASSENGER_1 - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 98 TARGET_UNIT_PASSENGER_2 - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 99 TARGET_UNIT_PASSENGER_3 - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 100 TARGET_UNIT_PASSENGER_4 - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 101 TARGET_UNIT_PASSENGER_5 - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 102 TARGET_UNIT_PASSENGER_6 - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 103 TARGET_UNIT_PASSENGER_7 - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CONE, TARGET_SELECT_CHECK_ENEMY, TARGET_DIR_FRONT}, // 104 TARGET_UNIT_CONE_ENEMY_104 - {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 105 TARGET_UNIT_UNK_105 - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CHANNEL, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 106 TARGET_DEST_CHANNEL_CASTER - {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_NYI, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 107 TARGET_UNK_DEST_AREA_UNK_107 - {TARGET_OBJECT_TYPE_GOBJ, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CONE, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_FRONT}, // 108 TARGET_GAMEOBJECT_CONE - {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 109 - {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_SELECT_CHECK_DEFAULT, TARGET_DIR_NONE}, // 110 TARGET_DEST_UNK_110 + {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 1 TARGET_UNIT_CASTER + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_CHECK_ENEMY, TARGET_DIR_NONE}, // 2 TARGET_UNIT_NEARBY_ENEMY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_CHECK_PARTY, TARGET_DIR_NONE}, // 3 TARGET_UNIT_NEARBY_PARTY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_CHECK_ALLY, TARGET_DIR_NONE}, // 4 TARGET_UNIT_NEARBY_ALLY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 5 TARGET_UNIT_PET + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_ENEMY, TARGET_DIR_NONE}, // 6 TARGET_UNIT_TARGET_ENEMY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_SRC, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_ENTRY, TARGET_DIR_NONE}, // 7 TARGET_UNIT_SRC_AREA_ENTRY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_ENTRY, TARGET_DIR_NONE}, // 8 TARGET_UNIT_DEST_AREA_ENTRY + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 9 TARGET_DEST_HOME + {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 10 + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_SRC, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 11 TARGET_UNIT_SRC_AREA_UNK_11 + {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 12 + {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 13 + {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 14 + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_SRC, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_ENEMY, TARGET_DIR_NONE}, // 15 TARGET_UNIT_SRC_AREA_ENEMY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_ENEMY, TARGET_DIR_NONE}, // 16 TARGET_UNIT_DEST_AREA_ENEMY + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 17 TARGET_DEST_DB + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 18 TARGET_DEST_CASTER + {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 19 + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_PARTY, TARGET_DIR_NONE}, // 20 TARGET_UNIT_CASTER_AREA_PARTY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_ALLY, TARGET_DIR_NONE}, // 21 TARGET_UNIT_TARGET_ALLY + {TARGET_OBJECT_TYPE_SRC, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 22 TARGET_SRC_CASTER + {TARGET_OBJECT_TYPE_GOBJ, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 23 TARGET_GAMEOBJECT_TARGET + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CONE, TARGET_CHECK_ENEMY, TARGET_DIR_FRONT}, // 24 TARGET_UNIT_CONE_ENEMY_24 + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 25 TARGET_UNIT_TARGET_ANY + {TARGET_OBJECT_TYPE_GOBJ_ITEM, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 26 TARGET_GAMEOBJECT_ITEM_TARGET + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 27 TARGET_UNIT_MASTER + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_ENEMY, TARGET_DIR_NONE}, // 28 TARGET_DEST_DYNOBJ_ENEMY + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_ALLY, TARGET_DIR_NONE}, // 29 TARGET_DEST_DYNOBJ_ALLY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_SRC, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_ALLY, TARGET_DIR_NONE}, // 30 TARGET_UNIT_SRC_AREA_ALLY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_ALLY, TARGET_DIR_NONE}, // 31 TARGET_UNIT_DEST_AREA_ALLY + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_FRONT_LEFT}, // 32 TARGET_DEST_CASTER_SUMMON + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_SRC, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_PARTY, TARGET_DIR_NONE}, // 33 TARGET_UNIT_SRC_AREA_PARTY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_PARTY, TARGET_DIR_NONE}, // 34 TARGET_UNIT_DEST_AREA_PARTY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_PARTY, TARGET_DIR_NONE}, // 35 TARGET_UNIT_TARGET_PARTY + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 36 TARGET_DEST_CASTER_UNK_36 + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_LAST, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_PARTY, TARGET_DIR_NONE}, // 37 TARGET_UNIT_LASTTARGET_AREA_PARTY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_CHECK_ENTRY, TARGET_DIR_NONE}, // 38 TARGET_UNIT_NEARBY_ENTRY + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 39 TARGET_DEST_CASTER_FISHING + {TARGET_OBJECT_TYPE_GOBJ, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_CHECK_ENTRY, TARGET_DIR_NONE}, // 40 TARGET_GAMEOBJECT_NEARBY_ENTRY + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_FRONT_RIGHT}, // 41 TARGET_DEST_CASTER_FRONT_RIGHT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_BACK_RIGHT}, // 42 TARGET_DEST_CASTER_BACK_RIGHT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_BACK_LEFT}, // 43 TARGET_DEST_CASTER_BACK_LEFT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_FRONT_LEFT}, // 44 TARGET_DEST_CASTER_FRONT_LEFT + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_ALLY, TARGET_DIR_NONE}, // 45 TARGET_UNIT_TARGET_CHAINHEAL_ALLY + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_CHECK_ENTRY, TARGET_DIR_NONE}, // 46 TARGET_DEST_NEARBY_ENTRY + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_FRONT}, // 47 TARGET_DEST_CASTER_FRONT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_BACK}, // 48 TARGET_DEST_CASTER_BACK + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_RIGHT}, // 49 TARGET_DEST_CASTER_RIGHT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_LEFT}, // 50 TARGET_DEST_CASTER_LEFT + {TARGET_OBJECT_TYPE_GOBJ, TARGET_REFERENCE_TYPE_SRC, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 51 TARGET_GAMEOBJECT_SRC_AREA + {TARGET_OBJECT_TYPE_GOBJ, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 52 TARGET_GAMEOBJECT_DEST_AREA + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_ENEMY, TARGET_DIR_NONE}, // 53 TARGET_DEST_TARGET_ENEMY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CONE, TARGET_CHECK_ENEMY, TARGET_DIR_FRONT}, // 54 TARGET_UNIT_CONE_ENEMY_54 + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 55 TARGET_DEST_CASTER_FRONT_LEAP + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_RAID, TARGET_DIR_NONE}, // 56 TARGET_UNIT_CASTER_AREA_RAID + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_RAID, TARGET_DIR_NONE}, // 57 TARGET_UNIT_TARGET_RAID + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_NEARBY, TARGET_CHECK_RAID, TARGET_DIR_NONE}, // 58 TARGET_UNIT_NEARBY_RAID + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CONE, TARGET_CHECK_ALLY, TARGET_DIR_FRONT}, // 59 TARGET_UNIT_CONE_ALLY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CONE, TARGET_CHECK_ENTRY, TARGET_DIR_FRONT}, // 60 TARGET_UNIT_CONE_ENTRY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_RAID_CLASS,TARGET_DIR_NONE}, // 61 TARGET_UNIT_TARGET_AREA_RAID_CLASS + {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 62 TARGET_UNK_62 + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 63 TARGET_DEST_TARGET_ANY + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_FRONT}, // 64 TARGET_DEST_TARGET_FRONT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_BACK}, // 65 TARGET_DEST_TARGET_BACK + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_RIGHT}, // 66 TARGET_DEST_TARGET_RIGHT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_LEFT}, // 67 TARGET_DEST_TARGET_LEFT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_FRONT_RIGHT}, // 68 TARGET_DEST_TARGET_FRONT_RIGHT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_BACK_RIGHT}, // 69 TARGET_DEST_TARGET_BACK_RIGHT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_BACK_LEFT}, // 70 TARGET_DEST_TARGET_BACK_LEFT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_FRONT_LEFT}, // 71 TARGET_DEST_TARGET_FRONT_LEFT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_RANDOM}, // 72 TARGET_DEST_CASTER_RANDOM + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_RANDOM}, // 73 TARGET_DEST_CASTER_RADIUS + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_RANDOM}, // 74 TARGET_DEST_TARGET_RANDOM + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_RANDOM}, // 75 TARGET_DEST_TARGET_RADIUS + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CHANNEL, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 76 TARGET_DEST_CHANNEL_TARGET + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CHANNEL, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 77 TARGET_UNIT_CHANNEL_TARGET + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_FRONT}, // 78 TARGET_DEST_DEST_FRONT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_BACK}, // 79 TARGET_DEST_DEST_BACK + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_RIGHT}, // 80 TARGET_DEST_DEST_RIGHT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_LEFT}, // 81 TARGET_DEST_DEST_LEFT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_FRONT_RIGHT}, // 82 TARGET_DEST_DEST_FRONT_RIGHT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_BACK_RIGHT}, // 83 TARGET_DEST_DEST_BACK_RIGHT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_BACK_LEFT}, // 84 TARGET_DEST_DEST_BACK_LEFT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_FRONT_LEFT}, // 85 TARGET_DEST_DEST_FRONT_LEFT + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_RANDOM}, // 86 TARGET_DEST_DEST_RANDOM + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 87 TARGET_DEST_DEST + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 88 TARGET_DEST_DYNOBJ_NONE + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 89 TARGET_DEST_TRAJ + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 90 TARGET_UNIT_TARGET_MINIPET + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_RANDOM}, // 91 TARGET_DEST_DEST_RADIUS + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 92 TARGET_UNIT_SUMMONER + {TARGET_OBJECT_TYPE_CORPSE, TARGET_REFERENCE_TYPE_SRC, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_ENEMY, TARGET_DIR_NONE}, // 93 TARGET_CORPSE_SRC_AREA_ENEMY + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 94 TARGET_UNIT_VEHICLE + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_PASSENGER, TARGET_DIR_NONE}, // 95 TARGET_UNIT_TARGET_PASSENGER + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 96 TARGET_UNIT_PASSENGER_0 + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 97 TARGET_UNIT_PASSENGER_1 + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 98 TARGET_UNIT_PASSENGER_2 + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 99 TARGET_UNIT_PASSENGER_3 + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 100 TARGET_UNIT_PASSENGER_4 + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 101 TARGET_UNIT_PASSENGER_5 + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 102 TARGET_UNIT_PASSENGER_6 + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 103 TARGET_UNIT_PASSENGER_7 + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CONE, TARGET_CHECK_ENEMY, TARGET_DIR_FRONT}, // 104 TARGET_UNIT_CONE_ENEMY_104 + {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 105 TARGET_UNIT_UNK_105 + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CHANNEL, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 106 TARGET_DEST_CHANNEL_CASTER + {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_DEST, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 107 TARGET_UNK_DEST_AREA_UNK_107 + {TARGET_OBJECT_TYPE_GOBJ, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_CONE, TARGET_CHECK_DEFAULT, TARGET_DIR_FRONT}, // 108 TARGET_GAMEOBJECT_CONE + {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 109 + {TARGET_OBJECT_TYPE_DEST, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 110 TARGET_DEST_UNK_110 }; SpellEffectInfo::SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* spellInfo, uint8 effIndex) @@ -481,6 +484,7 @@ SpellEffectInfo::SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* ItemType = spellEntry->EffectItemType[effIndex]; TriggerSpell = spellEntry->EffectTriggerSpell[effIndex]; SpellClassMask = spellEntry->EffectSpellClassMask[effIndex]; + ImplicitTargetConditions = NULL; } bool SpellEffectInfo::IsEffect() const @@ -938,6 +942,11 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry) ChainEntry = NULL; } +SpellInfo::~SpellInfo() +{ + _UnloadImplicitTargetConditionLists(); +} + bool SpellInfo::HasEffect(SpellEffects effect) const { for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) @@ -1563,38 +1572,99 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a return SPELL_CAST_OK; } -SpellCastResult SpellInfo::CheckTarget(Unit const* caster, Unit const* target, bool implicit) const +SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* target, bool implicit) const { if (AttributesEx & SPELL_ATTR1_CANT_TARGET_SELF && caster == target) return SPELL_FAILED_BAD_TARGETS; - if (AttributesEx & SPELL_ATTR1_CANT_TARGET_IN_COMBAT && target->isInCombat()) - return SPELL_FAILED_TARGET_AFFECTING_COMBAT; + // check visibility - ignore stealth for implicit (area) targets + if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE) && !caster->canSeeOrDetect(target, implicit)) + return SPELL_FAILED_BAD_TARGETS; + + Unit const* unitTarget; + + // creature/player specific target checks + if (unitTarget = target->ToUnit()) + { + if (AttributesEx & SPELL_ATTR1_CANT_TARGET_IN_COMBAT && unitTarget->isInCombat()) + return SPELL_FAILED_TARGET_AFFECTING_COMBAT; + + // only spells with SPELL_ATTR3_ONLY_TARGET_GHOSTS can target ghosts + if (((AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS) != 0) != unitTarget->HasAuraType(SPELL_AURA_GHOST)) + { + if (AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS) + return SPELL_FAILED_TARGET_NOT_GHOST; + else + return SPELL_FAILED_BAD_TARGETS; + } + + if (caster != unitTarget) + { + if (caster->GetTypeId() == TYPEID_PLAYER) + { + // Do not allow these spells to target creatures not tapped by us (Banish, Polymorph, many quest spells) + if (AttributesEx2 & SPELL_ATTR2_CANT_TARGET_TAPPED) + if (Creature const* targetCreature = unitTarget->ToCreature()) + if (targetCreature->hasLootRecipient() && !targetCreature->isTappedBy(caster->ToPlayer())) + return SPELL_FAILED_CANT_CAST_ON_TAPPED; + + if (AttributesCu & SPELL_ATTR0_CU_PICKPOCKET) + { + if (unitTarget->GetTypeId() == TYPEID_PLAYER) + return SPELL_FAILED_BAD_TARGETS; + else if ((unitTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) == 0) + return SPELL_FAILED_TARGET_NO_POCKETS; + } + + // Not allow disarm unarmed player + if (Mechanic == MECHANIC_DISARM) + { + if (unitTarget->GetTypeId() == TYPEID_PLAYER) + { + Player const* player = unitTarget->ToPlayer(); + if (!player->GetWeaponForAttack(BASE_ATTACK) || !player->IsUseEquipedWeapon(true)) + return SPELL_FAILED_TARGET_NO_WEAPONS; + } + else if (!unitTarget->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID)) + return SPELL_FAILED_TARGET_NO_WEAPONS; + } + } + } + } + // corpse specific target checks + else if (Corpse const* corpseTarget = target->ToCorpse()) + { + // cannot target bare bones + if (corpseTarget->GetType() == CORPSE_BONES) + return SPELL_FAILED_BAD_TARGETS; + // we have to use owner for some checks (aura preventing resurrection for example) + if (Player* owner = ObjectAccessor::FindPlayer(corpseTarget->GetOwnerGUID())) + unitTarget = owner; + // we're not interested in corpses without owner + else + return SPELL_FAILED_BAD_TARGETS; + } + // other types of objects - always valid + else return SPELL_CAST_OK; - if (AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_PLAYERS && !target->ToPlayer()) + // corpseOwner and unit specific target checks + if (AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_PLAYERS && !unitTarget->ToPlayer()) return SPELL_FAILED_TARGET_NOT_PLAYER; - if (!IsAllowingDeadTarget() && !target->isAlive()) + if (!IsAllowingDeadTarget() && !unitTarget->isAlive()) return SPELL_FAILED_TARGETS_DEAD; - if (AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS && !(!target->isAlive() && target->HasAuraType(SPELL_AURA_GHOST))) - return SPELL_FAILED_TARGET_NOT_GHOST; - // check this flag only for implicit targets (chain and area), allow to explicitly target units for spells like Shield of Righteousness - if (implicit && AttributesEx6 & SPELL_ATTR6_CANT_TARGET_CROWD_CONTROLLED && !target->CanFreeMove()) + if (implicit && AttributesEx6 & SPELL_ATTR6_CANT_TARGET_CROWD_CONTROLLED && !unitTarget->CanFreeMove()) return SPELL_FAILED_BAD_TARGETS; - // check visibility - ignore stealth for implicit (area) targets - if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE) && !caster->canSeeOrDetect(target, implicit)) - return SPELL_FAILED_BAD_TARGETS; - // checked in Unit::IsValidAttack/AssistTarget, shouldn't be checked for ENTRY targets //if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_UNTARGETABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) // return SPELL_FAILED_BAD_TARGETS; //if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_POSSESSED_FRIENDS) - if (!CheckTargetCreatureType(target)) + if (!CheckTargetCreatureType(unitTarget)) { if (target->GetTypeId() == TYPEID_PLAYER) return SPELL_FAILED_TARGET_IS_PLAYER; @@ -1603,65 +1673,32 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, Unit const* target, b } // check GM mode and GM invisibility - only for player casts (npc casts are controlled by AI) and negative spells - if (target != caster && (caster->IsControlledByPlayer() || !IsPositive()) && target->GetTypeId() == TYPEID_PLAYER) + if (unitTarget != caster && (caster->IsControlledByPlayer() || !IsPositive()) && unitTarget->GetTypeId() == TYPEID_PLAYER) { - if (!target->ToPlayer()->IsVisible()) + if (!unitTarget->ToPlayer()->IsVisible()) return SPELL_FAILED_BM_OR_INVISGOD; - if (target->ToPlayer()->isGameMaster()) + if (unitTarget->ToPlayer()->isGameMaster()) return SPELL_FAILED_BM_OR_INVISGOD; } // not allow casting on flying player - if (target->HasUnitState(UNIT_STATE_IN_FLIGHT)) + if (unitTarget->HasUnitState(UNIT_STATE_IN_FLIGHT)) return SPELL_FAILED_BAD_TARGETS; - if (TargetAuraState && !target->HasAuraState(AuraStateType(TargetAuraState), this, caster)) + if (TargetAuraState && !unitTarget->HasAuraState(AuraStateType(TargetAuraState), this, caster)) return SPELL_FAILED_TARGET_AURASTATE; - if (TargetAuraStateNot && target->HasAuraState(AuraStateType(TargetAuraStateNot), this, caster)) + if (TargetAuraStateNot && unitTarget->HasAuraState(AuraStateType(TargetAuraStateNot), this, caster)) return SPELL_FAILED_TARGET_AURASTATE; - if (TargetAuraSpell && !target->HasAura(sSpellMgr->GetSpellIdForDifficulty(TargetAuraSpell, caster))) + if (TargetAuraSpell && !unitTarget->HasAura(sSpellMgr->GetSpellIdForDifficulty(TargetAuraSpell, caster))) return SPELL_FAILED_TARGET_AURASTATE; - if (ExcludeTargetAuraSpell && target->HasAura(sSpellMgr->GetSpellIdForDifficulty(ExcludeTargetAuraSpell, caster))) + if (ExcludeTargetAuraSpell && unitTarget->HasAura(sSpellMgr->GetSpellIdForDifficulty(ExcludeTargetAuraSpell, caster))) return SPELL_FAILED_TARGET_AURASTATE; - if (caster != target) - { - if (caster->GetTypeId() == TYPEID_PLAYER) - { - // Do not allow these spells to target creatures not tapped by us (Banish, Polymorph, many quest spells) - if (AttributesEx2 & SPELL_ATTR2_CANT_TARGET_TAPPED) - if (Creature const* targetCreature = target->ToCreature()) - if (targetCreature->hasLootRecipient() && !targetCreature->isTappedBy(caster->ToPlayer())) - return SPELL_FAILED_CANT_CAST_ON_TAPPED; - - if (AttributesCu & SPELL_ATTR0_CU_PICKPOCKET) - { - if (target->GetTypeId() == TYPEID_PLAYER) - return SPELL_FAILED_BAD_TARGETS; - else if ((target->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) == 0) - return SPELL_FAILED_TARGET_NO_POCKETS; - } - - // Not allow disarm unarmed player - if (Mechanic == MECHANIC_DISARM) - { - if (target->GetTypeId() == TYPEID_PLAYER) - { - Player const* player = target->ToPlayer(); - if (!player->GetWeaponForAttack(BASE_ATTACK) || !player->IsUseEquipedWeapon(true)) - return SPELL_FAILED_TARGET_NO_WEAPONS; - } - else if (!target->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID)) - return SPELL_FAILED_TARGET_NO_WEAPONS; - } - } - } - - if (target->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)) + if (unitTarget->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)) if (HasEffect(SPELL_EFFECT_SELF_RESURRECT) || HasEffect(SPELL_EFFECT_RESURRECT) || HasEffect(SPELL_EFFECT_RESURRECT_NEW)) return SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED; @@ -2035,13 +2072,19 @@ float SpellInfo::GetMinRange(bool positive) const return RangeEntry->minRangeHostile; } -float SpellInfo::GetMaxRange(bool positive) const +float SpellInfo::GetMaxRange(bool positive, Unit* caster, Spell* spell) const { if (!RangeEntry) return 0.0f; + float range; if (positive) - return RangeEntry->maxRangeFriend; - return RangeEntry->maxRangeHostile; + range = RangeEntry->maxRangeFriend; + else + range = RangeEntry->maxRangeHostile; + if (caster) + if (Player* modOwner = caster->GetSpellModOwner()) + modOwner->ApplySpellMod(Id, SPELLMOD_RANGE, range, spell); + return range; } int32 SpellInfo::GetDuration() const @@ -2552,3 +2595,20 @@ bool SpellInfo::_IsPositiveTarget(uint32 targetA, uint32 targetB) return _IsPositiveTarget(targetB, 0); return true; } + +void SpellInfo::_UnloadImplicitTargetConditionLists() +{ + // find the same instances of ConditionList and delete them. + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + { + ConditionList* cur = Effects[i].ImplicitTargetConditions; + if (!cur) + continue; + for (uint8 j = i; j < MAX_SPELL_EFFECTS; ++j) + { + if (Effects[j].ImplicitTargetConditions == cur) + Effects[j].ImplicitTargetConditions = NULL; + } + delete cur; + } +} diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 65be5981c64..69ea07f7563 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -36,6 +36,7 @@ struct SpellRangeEntry; struct SpellRadiusEntry; struct SpellEntry; struct SpellCastTimesEntry; +struct Condition; enum SpellCastTargetFlags { @@ -105,15 +106,16 @@ enum SpellTargetObjectTypes TARGET_OBJECT_TYPE_CORPSE_ALLY, }; -enum SpellTargetSelectionCheckTypes +enum SpellTargetCheckTypes { - TARGET_SELECT_CHECK_DEFAULT, - TARGET_SELECT_CHECK_ENTRY, - TARGET_SELECT_CHECK_ENEMY, - TARGET_SELECT_CHECK_ALLY, - TARGET_SELECT_CHECK_PARTY, - TARGET_SELECT_CHECK_RAID, - TARGET_SELECT_CHECK_PASSENGER, + TARGET_CHECK_DEFAULT, + TARGET_CHECK_ENTRY, + TARGET_CHECK_ENEMY, + TARGET_CHECK_ALLY, + TARGET_CHECK_PARTY, + TARGET_CHECK_RAID, + TARGET_CHECK_RAID_CLASS, + TARGET_CHECK_PASSENGER, }; enum SpellTargetDirectionTypes @@ -220,7 +222,7 @@ public: SpellTargetSelectionCategories GetSelectionCategory() const; SpellTargetReferenceTypes GetReferenceType() const; SpellTargetObjectTypes GetObjectType() const; - SpellTargetSelectionCheckTypes GetSelectionCheckType() const; + SpellTargetCheckTypes GetCheckType() const; SpellTargetDirectionTypes GetDirectionType() const; float CalcDirectionAngle() const; @@ -240,7 +242,7 @@ private: SpellTargetObjectTypes ObjectType; // type of object returned by target type SpellTargetReferenceTypes ReferenceType; // defines which object is used as a reference when selecting target SpellTargetSelectionCategories SelectionCategory; - SpellTargetSelectionCheckTypes SelectionCheckType; // defines selection criteria + SpellTargetCheckTypes SelectionCheckType; // defines selection criteria SpellTargetDirectionTypes DirectionType; // direction for cone and dest targets }; static StaticData _data[TOTAL_SPELL_TARGETS]; @@ -271,6 +273,7 @@ public: uint32 ItemType; uint32 TriggerSpell; flag96 SpellClassMask; + std::list* ImplicitTargetConditions; SpellEffectInfo() {} SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* spellInfo, uint8 effIndex); @@ -388,6 +391,7 @@ public: SpellChainNode const* ChainEntry; SpellInfo(SpellEntry const* spellEntry); + ~SpellInfo(); bool HasEffect(SpellEffects effect) const; bool HasAura(AuraType aura) const; @@ -438,7 +442,7 @@ public: SpellCastResult CheckShapeshift(uint32 form) const; SpellCastResult CheckLocation(uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player = NULL) const; - SpellCastResult CheckTarget(Unit const* caster, Unit const* target, bool implicit = true) const; + SpellCastResult CheckTarget(Unit const* caster, WorldObject const* target, bool implicit = true) const; SpellCastResult CheckExplicitTarget(Unit const* caster, WorldObject const* target, Item const* itemTarget = NULL) const; bool CheckTargetCreatureType(Unit const* target) const; @@ -456,7 +460,7 @@ public: SpellSpecificType GetSpellSpecific() const; float GetMinRange(bool positive = false) const; - float GetMaxRange(bool positive = false) const; + float GetMaxRange(bool positive = false, Unit* caster = NULL, Spell* spell = NULL) const; int32 GetDuration() const; int32 GetMaxDuration() const; @@ -482,6 +486,9 @@ public: bool _IsPositiveEffect(uint8 effIndex, bool deep) const; bool _IsPositiveSpell() const; static bool _IsPositiveTarget(uint32 targetA, uint32 targetB); + + // unloading helpers + void _UnloadImplicitTargetConditionLists(); }; #endif // _SPELLINFO_H diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index ff4eaae42f2..c1b267d9fac 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2644,11 +2644,20 @@ void SpellMgr::UnloadSpellInfoStore() for (uint32 i = 0; i < mSpellInfoMap.size(); ++i) { if (mSpellInfoMap[i]) - delete mSpellInfoMap[i]; + delete mSpellInfoMap[i]; } mSpellInfoMap.clear(); } +void SpellMgr::UnloadSpellInfoImplicitTargetConditionLists() +{ + for (uint32 i = 0; i < mSpellInfoMap.size(); ++i) + { + if (mSpellInfoMap[i]) + mSpellInfoMap[i]->_UnloadImplicitTargetConditionLists(); + } +} + void SpellMgr::LoadSpellCustomAttr() { uint32 oldMSTime = getMSTime(); diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 14137b6a91b..9fffd474651 100755 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -360,17 +360,6 @@ struct SpellThreatEntry typedef std::map SpellThreatMap; -// Spell script target related declarations (accessed using SpellMgr functions) -enum SpellScriptTargetType -{ - SPELL_TARGET_TYPE_GAMEOBJECT = 0, - SPELL_TARGET_TYPE_CREATURE = 1, - SPELL_TARGET_TYPE_DEAD = 2, - SPELL_TARGET_TYPE_CONTROLLED = 3, -}; - -#define MAX_SPELL_TARGET_TYPE 4 - // coordinates for spells (accessed using SpellMgr functions) struct SpellTargetPosition { @@ -726,6 +715,7 @@ class SpellMgr void LoadSpellAreas(); void LoadSpellInfoStore(); void UnloadSpellInfoStore(); + void UnloadSpellInfoImplicitTargetConditionLists(); void LoadSpellCustomAttr(); void LoadDbcDataCorrections(); diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 14dd32a71b6..03fea614c0d 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -473,11 +473,6 @@ void SpellScript::GetSummonPosition(uint32 i, Position &pos, float radius = 0.0f m_spell->GetSummonPosition(i, pos, radius, count); } -void SpellScript::SearchAreaTarget(std::list &TagUnitMap, float radius, SpellNotifyPushType type, SpellTargets TargetType, uint32 entry) -{ - m_spell->SearchAreaTarget(TagUnitMap, radius, type, TargetType, entry); -} - void SpellScript::PreventHitEffect(SpellEffIndex effIndex) { if (!IsInHitPhase() && !IsInEffectHook()) diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 09b9eaebd62..1bf8d25adef 100755 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -336,7 +336,6 @@ class SpellScript : public _SpellScript void PreventHitHeal() { SetHitHeal(0); } Spell* GetSpell() { return m_spell; } void GetSummonPosition(uint32 i, Position &pos, float radius, uint32 count); - void SearchAreaTarget(std::list &TagUnitMap, float radius, SpellNotifyPushType type, SpellTargets TargetType, uint32 entry); // returns current spell hit target aura Aura* GetHitAura(); // prevents applying aura on current spell hit target diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index d5695a0f39d..19ed96e8885 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -62,7 +62,7 @@ class OrientationCheck : public std::unary_function explicit OrientationCheck(Unit* _caster) : caster(_caster) { } bool operator() (Unit* unit) { - return !unit->isInFront(caster, 40.0f, 2.5f); + return !unit->isInFront(caster, 2.5f) || !unit->IsWithinDist(caster, 40.0f); } private: diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index da46d016e91..c4f973726bc 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -1736,25 +1736,29 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader if (Vehicle* vehicle = GetCaster()->GetVehicleKit()) if (Unit* passenger = vehicle->GetPassenger(damage - 1)) { - std::list unitList; // use 99 because it is 3d search - SearchAreaTarget(unitList, 99, PUSH_DST_CENTER, SPELL_TARGETS_ENTRY, NPC_SEAT); + std::list targetList; + Trinity::WorldObjectSpellAreaTargetCheck check(99, GetTargetDest(), GetCaster(), GetCaster(), GetSpellInfo(), TARGET_CHECK_DEFAULT, NULL); + Trinity::WorldObjectListSearcher searcher(GetCaster(), targetList, check); + GetCaster()->GetMap()->VisitAll(GetCaster()->m_positionX, GetCaster()->m_positionY, 99, searcher); float minDist = 99 * 99; Unit* target = NULL; - for (std::list::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) + for (std::list::iterator itr = targetList.begin(); itr != targetList.end(); ++itr) { - if (Vehicle* seat = (*itr)->GetVehicleKit()) - if (!seat->GetPassenger(0)) - if (Unit* device = seat->GetPassenger(2)) - if (!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) - { - float dist = (*itr)->GetExactDistSq(targets.GetDst()); - if (dist < minDist) - { - minDist = dist; - target = (*itr); - } - } + if (Unit* unit = (*itr)->ToUnit()) + if (unit->GetEntry() == NPC_SEAT) + if (Vehicle* seat = unit->GetVehicleKit()) + if (!seat->GetPassenger(0)) + if (Unit* device = seat->GetPassenger(2)) + if (!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) + { + float dist = unit->GetExactDistSq(targets.GetDst()); + if (dist < minDist) + { + minDist = dist; + target = unit; + } + } } if (target && target->IsWithinDist2d(targets.GetDst(), GetSpellInfo()->Effects[effIndex].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct passenger->EnterVehicle(target, 0); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 638a17bc4f9..3835cb8ca0f 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -196,7 +196,7 @@ class spell_gen_cannibalize : public SpellScriptLoader float max_range = GetSpellInfo()->GetMaxRange(false); WorldObject* result = NULL; // search for nearby enemy corpse in range - Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_SELECT_CHECK_ENEMY); + Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_CHECK_ENEMY); Trinity::WorldObjectSearcher searcher(caster, result, check); caster->GetMap()->VisitFirstFound(caster->m_positionX, caster->m_positionY, max_range, searcher); if (!result) diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index dd9bfd90a0b..855af75cd83 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -532,7 +532,7 @@ class spell_hun_pet_carrion_feeder : public SpellScriptLoader float max_range = GetSpellInfo()->GetMaxRange(false); WorldObject* result = NULL; // search for nearby enemy corpse in range - Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_SELECT_CHECK_ENEMY); + Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_CHECK_ENEMY); Trinity::WorldObjectSearcher searcher(caster, result, check); caster->GetMap()->VisitFirstFound(caster->m_positionX, caster->m_positionY, max_range, searcher); if (!result) -- cgit v1.2.3 From d35356a7ae3c0020f90b4683c38d398dfe0ced08 Mon Sep 17 00:00:00 2001 From: frozenarmor Date: Wed, 22 Feb 2012 03:14:34 +0500 Subject: Scripts/PoS: Fix error in Forgemaster Garfrost text. Signed-off-by: frozenarmor --- .../Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index 0f9495d4928..64609efd7ff 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -27,7 +27,7 @@ enum Yells SAY_PHASE2 = -1658005, SAY_PHASE3 = -1658006, - SAY_TYRANNUS_DEATH = -1659007, + SAY_TYRANNUS_DEATH = -1658007, }; enum Spells -- cgit v1.2.3 From a3f3058499ee0f35c684588a386c6b69683adf70 Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Wed, 22 Feb 2012 12:26:05 +0100 Subject: Core/Vehicles: Remove some wrong/redundant calls to Unit::ExitVehicle. The aura system already handles it in most places. Also add some documentation on upcoming work on making passenger exit positions work. --- src/server/game/Entities/Unit/Unit.cpp | 17 +++++++++++------ .../scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp | 2 ++ 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'src/server/scripts/Northrend') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 0e3e2f593fa..70ca35b7203 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -13692,7 +13692,6 @@ void Unit::RemoveFromWorld() RemoveAllGameObjects(); RemoveAllDynObjects(); - ExitVehicle(); UnsummonAllTotems(); RemoveAllControlled(); @@ -15591,9 +15590,6 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) if (Player* killed = victim->ToPlayer()) sScriptMgr->OnPlayerKilledByCreature(killerCre, killed); } - - if (victim->GetVehicle()) - victim->ExitVehicle(); } void Unit::SetControlled(bool apply, UnitState state) @@ -17002,12 +16998,21 @@ void Unit::ChangeSeat(int8 seatId, bool next) void Unit::ExitVehicle(Position const* exitPosition) { - // This function can be called at upper level code to initialize an exit from the passenger's side. + //! This function can be called at upper level code to initialize an exit from the passenger's side. if (!m_vehicle) return; GetVehicleBase()->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE, GetGUID()); - _ExitVehicle(exitPosition); + //! The following call would not even be executed successfully as the + //! SPELL_AURA_CONTROL_VEHICLE unapply handler already calls _ExitVehicle without + //! specifying an exitposition. The subsequent call below would return on if (!m_vehicle). + /*_ExitVehicle(exitPosition);*/ + //! To do: + //! We need to allow SPELL_AURA_CONTROL_VEHICLE unapply handlers in spellscripts + //! to specify exit coordinates and either store those per passenger, or we need to + //! init spline movement based on those coordinates in unapply handlers, and + //! relocate exiting passengers based on Unit::moveSpline data. Either way, + //! Coming Soon™ } void Unit::_ExitVehicle(Position const* exitPosition) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index a156e6ef08b..d5034e4827e 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -485,6 +485,8 @@ class spell_ulduar_squeezed_lifeless : public SpellScriptLoader if (!GetHitPlayer() || !GetHitPlayer()->GetVehicle()) return; + //! Proper exit position does not work currently, + //! See documentation in void Unit::ExitVehicle(Position const* exitPosition) Position pos; pos.m_positionX = 1756.25f + irand(-3, 3); pos.m_positionY = -8.3f + irand(-3, 3); -- cgit v1.2.3