Index: ScriptMgr.cpp =================================================================== --- ScriptMgr.cpp (revision 85) +++ ScriptMgr.cpp (working copy) @@ -1067,6 +1067,20 @@ } } +void ScriptedAI::DoMeleeAttackIfReady() +{ + //If we are within range melee the target + if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) + { + //Make sure our attack is ready and we arn't currently casting + if( m_creature->isAttackReady() && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) + { + m_creature->AttackerStateUpdate(m_creature->getVictim()); + m_creature->resetAttackTimer(); + } + } +} + void ScriptedAI::DoStartRangedAttack(Unit* victim) { if (!victim) @@ -1093,14 +1107,14 @@ void ScriptedAI::DoCast(Unit* victim, uint32 spelId) { - if (!victim || m_creature->m_currentSpell) + if (!victim || m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) return; m_creature->CastSpell(victim, spelId, false); } void ScriptedAI::DoCastSpell(Unit* who,SpellEntry const *spellInfo) { - if (!who || m_creature->m_currentSpell) + if (!who || m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) return; m_creature->StopMoving(); Index: ScriptMgr.h =================================================================== --- ScriptMgr.h (revision 85) +++ ScriptMgr.h (working copy) @@ -172,6 +172,9 @@ //Start attack of victim but stay in position void DoStartRangedAttack(Unit* victim); + //Do melee swing of current victim if in rnage and ready and not casting + void DoMeleeAttackIfReady(); + //Stop attack of current victim void DoStopAttack(); Index: scripts/boss/boss_emeriss.cpp =================================================================== --- scripts/boss/boss_emeriss.cpp (revision 85) +++ scripts/boss/boss_emeriss.cpp (working copy) @@ -189,17 +189,7 @@ } else CorruptionofEarth_Timer -= diff; } - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/boss/boss_taerar.cpp =================================================================== --- scripts/boss/boss_taerar.cpp (revision 85) +++ scripts/boss/boss_taerar.cpp (working copy) @@ -125,7 +125,6 @@ //Become unbanished again m_creature->setFaction(14); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->m_canMove = true; Shades = false; } else if (Shades) { @@ -208,77 +207,61 @@ if ( !Shades && (int) (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() +0.5) == 75) { - if (Summon_Timer < diff) - { + if (Summon_Timer < diff) + { - //Inturrupt any spell casting - m_creature->InterruptSpell(); - m_creature->m_canMove = false; - m_creature->setFaction(35); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + //Inturrupt any spell casting + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); + m_creature->setFaction(35); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //Cast - SummonShades(m_creature->getVictim()); - SummonShades(m_creature->getVictim()); - SummonShades(m_creature->getVictim()); - Summon_Timer = 120000; + //Cast + SummonShades(m_creature->getVictim()); + SummonShades(m_creature->getVictim()); + SummonShades(m_creature->getVictim()); + Summon_Timer = 120000; } else Summon_Timer -= diff; - } + } //Summon 3 Shades if ( !Shades && (int) (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() +0.5) == 50) { - if (Summon_Timer < diff) - { + if (Summon_Timer < diff) + { - //Inturrupt any spell casting - m_creature->InterruptSpell(); - m_creature->m_canMove = false; - m_creature->setFaction(35); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + //Inturrupt any spell casting + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); + m_creature->setFaction(35); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //Cast - SummonShades(m_creature->getVictim()); - SummonShades(m_creature->getVictim()); - SummonShades(m_creature->getVictim()); - Summon_Timer = 120000; + //Cast + SummonShades(m_creature->getVictim()); + SummonShades(m_creature->getVictim()); + SummonShades(m_creature->getVictim()); + Summon_Timer = 120000; } else Summon_Timer -= diff; - } + } - - //Summon 3 Shades if ( !Shades && (int) (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() +0.5) == 25) { + if (Summon_Timer < diff) + { + //Inturrupt any spell casting + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); + m_creature->setFaction(35); + m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (Summon_Timer < diff) - { - - //Inturrupt any spell casting - m_creature->InterruptSpell(); - m_creature->m_canMove = false; - m_creature->setFaction(35); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - - //Cast - SummonShades(m_creature->getVictim()); - SummonShades(m_creature->getVictim()); - SummonShades(m_creature->getVictim()); - Summon_Timer = 120000; + //Cast + SummonShades(m_creature->getVictim()); + SummonShades(m_creature->getVictim()); + SummonShades(m_creature->getVictim()); + Summon_Timer = 120000; } else Summon_Timer -= diff; - } - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } } + + DoMeleeAttackIfReady(); } } }; Index: scripts/boss/boss_ysondre.cpp =================================================================== --- scripts/boss/boss_ysondre.cpp (revision 85) +++ scripts/boss/boss_ysondre.cpp (working copy) @@ -242,16 +242,7 @@ } else SummonDruids_Timer -= diff; } - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/creature/mob_defias.cpp =================================================================== --- scripts/creature/mob_defias.cpp (revision 85) +++ scripts/creature/mob_defias.cpp (working copy) @@ -68,7 +68,6 @@ DoStartMeleeAttack(who); if (!m_creature->IsWithinDistInMap(who, ATTACK_DISTANCE)) { - m_creature->m_canMove = false; IsSelfRooted = true; } @@ -149,7 +148,7 @@ if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) { //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) + if( m_creature->isAttackReady() && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { bool Healing = false; SpellEntry const *info = NULL; @@ -180,7 +179,7 @@ else { //Only run this code if we arn't already casting - if (!m_creature->m_currentSpell) + if (!m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { bool Healing = false; SpellEntry const *info = NULL; @@ -199,7 +198,6 @@ //If we are currently moving stop us and set the movement generator if (!IsSelfRooted) { - m_creature->m_canMove = false; IsSelfRooted = true; } @@ -218,8 +216,7 @@ else if (IsSelfRooted) { //Cancel our current spell and then allow movement agian - m_creature->InterruptSpell(); - m_creature->m_canMove = true; + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); IsSelfRooted = false; } } Index: scripts/creature/mob_generic_creature.cpp =================================================================== --- scripts/creature/mob_generic_creature.cpp (revision 85) +++ scripts/creature/mob_generic_creature.cpp (working copy) @@ -54,7 +54,6 @@ DoStartMeleeAttack(who); if (!m_creature->IsWithinDistInMap(who, ATTACK_DISTANCE)) { - m_creature->m_canMove = false; IsSelfRooted = true; } @@ -79,7 +78,6 @@ DoStartMeleeAttack(who); if (!m_creature->IsWithinDistInMap(who, ATTACK_DISTANCE)) { - m_creature->m_canMove = false; IsSelfRooted = true; } @@ -134,7 +132,7 @@ if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) { //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) + if( m_creature->isAttackReady() && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { bool Healing = false; SpellEntry const *info = NULL; @@ -165,7 +163,7 @@ else { //Only run this code if we arn't already casting - if (!m_creature->m_currentSpell) + if (!m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { bool Healing = false; SpellEntry const *info = NULL; @@ -184,7 +182,6 @@ //If we are currently moving stop us and set the movement generator if (!IsSelfRooted) { - m_creature->m_canMove = false; IsSelfRooted = true; } @@ -203,8 +200,7 @@ else if (IsSelfRooted) { //Cancel our current spell and then allow movement agian - m_creature->InterruptSpell(); - m_creature->m_canMove = true; + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); IsSelfRooted = false; } } Index: scripts/creature/mob_kobold.cpp =================================================================== --- scripts/creature/mob_kobold.cpp (revision 85) +++ scripts/creature/mob_kobold.cpp (working copy) @@ -134,7 +134,7 @@ if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) { //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) + if( m_creature->isAttackReady() && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { bool Healing = false; SpellEntry const *info = NULL; @@ -165,7 +165,7 @@ else { //Only run this code if we arn't already casting - if (!m_creature->m_currentSpell) + if (!m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { bool Healing = false; SpellEntry const *info = NULL; @@ -203,7 +203,7 @@ else if ((*m_creature)->top()->GetMovementGeneratorType()!=TARGETED_MOTION_TYPE) { //Cancel our current spell and then mutate new movement generator - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); (*m_creature)->Clear(false); (*m_creature)->Mutate(new TargetedMovementGenerator(*m_creature->getVictim())); } Index: scripts/creature/mob_shade_of_taerar.cpp =================================================================== --- scripts/creature/mob_shade_of_taerar.cpp (revision 85) +++ scripts/creature/mob_shade_of_taerar.cpp (working copy) @@ -102,16 +102,7 @@ PosionBreath_Timer = 15000; }else PosionBreath_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/creature/simple_ai.cpp =================================================================== --- scripts/creature/simple_ai.cpp (revision 85) +++ scripts/creature/simple_ai.cpp (working copy) @@ -195,7 +195,7 @@ if (Spell_Timer[i] < diff) { //Check Current spell - if (!(Spell[i].InturruptPreviousCast && m_creature->m_currentSpell)) + if (!(Spell[i].InturruptPreviousCast && m_creature->m_currentSpells[CURRENT_GENERIC_SPELL])) { Unit* target = NULL; @@ -244,15 +244,6 @@ } - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } \ No newline at end of file Index: scripts/custom/custom_example.cpp =================================================================== --- scripts/custom/custom_example.cpp (revision 85) +++ scripts/custom/custom_example.cpp (working copy) @@ -254,22 +254,7 @@ DoCast(m_creature,SPELL_ENRAGE); }else Phase_Timer -= diff; - - //If we are within range melee the target - if( m_creature->getVictim() && m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Check if our attack is ready (swing timer) - if( m_creature->isAttackReady() ) - { - //This here causes us to flip between targets. - //It doesn't do very much right now but it is a decent placeholder - //for when we get an aggro system in place - - //Send our melee swing and then reset our attack timer - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/guard/guard_ai.cpp =================================================================== --- scripts/guard/guard_ai.cpp (revision 85) +++ scripts/guard/guard_ai.cpp (working copy) @@ -131,7 +131,7 @@ if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) { //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) + if( m_creature->isAttackReady() && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { bool Healing = false; SpellEntry const *info = NULL; @@ -162,7 +162,7 @@ else { //Only run this code if we arn't already casting - if (!m_creature->m_currentSpell) + if (!m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { bool Healing = false; SpellEntry const *info = NULL; @@ -200,7 +200,7 @@ else if ((*m_creature)->top()->GetMovementGeneratorType()!=TARGETED_MOTION_TYPE) { //Cancel our current spell and then mutate new movement generator - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); (*m_creature)->Clear(false); (*m_creature)->Mutate(new TargetedMovementGenerator(*m_creature->getVictim())); } Index: scripts/item/purification_mixture.cpp =================================================================== --- scripts/item/purification_mixture.cpp (revision 85) +++ scripts/item/purification_mixture.cpp (working copy) @@ -25,7 +25,7 @@ { player->CastSpell(player,SPELL_PURIFY,true); - if(!player->m_currentSpell) + if(!player->m_currentSpells[CURRENT_GENERIC_SPELL]) { if (rand()%100 < 65) { Index: scripts/zone/azshara/boss_azuregos.cpp =================================================================== --- scripts/zone/azshara/boss_azuregos.cpp (revision 85) +++ scripts/zone/azshara/boss_azuregos.cpp (working copy) @@ -145,17 +145,7 @@ Enrage_Timer = 30000; }else Enrage_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_ambassador_flamelash.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_ambassador_flamelash.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_ambassador_flamelash.cpp (working copy) @@ -131,17 +131,7 @@ Spirit_Timer = 30000; }else Spirit_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_angerrel.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_angerrel.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_angerrel.cpp (working copy) @@ -121,18 +121,7 @@ Strike_Timer = 10000; }else Strike_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_anubshiah.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_anubshiah.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_anubshiah.cpp (working copy) @@ -156,16 +156,7 @@ EnvelopingWeb_Timer = 12000; }else EnvelopingWeb_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_baelgar.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_baelgar.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_baelgar.cpp (working copy) @@ -103,16 +103,7 @@ SpawnOfBaelgar_Timer = 25000; }else SpawnOfBaelgar_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_doomrel.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_doomrel.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_doomrel.cpp (working copy) @@ -172,16 +172,7 @@ Voidwalkers = true; } - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_doperel.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_doperel.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_doperel.cpp (working copy) @@ -117,17 +117,7 @@ Gouge_Timer = 8000; }else Gouge_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_emperor_dagran_thaurissan.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_emperor_dagran_thaurissan.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_emperor_dagran_thaurissan.cpp (working copy) @@ -132,18 +132,7 @@ MortalStrike_Timer = 16000; }else MortalStrike_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_fineous_darkvire.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_fineous_darkvire.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_fineous_darkvire.cpp (working copy) @@ -113,16 +113,7 @@ Kick_Timer = 7000; }else Kick_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_general_angerforge.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_general_angerforge.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_general_angerforge.cpp (working copy) @@ -195,16 +195,7 @@ Medics = true; } - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_gloomrel.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_gloomrel.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_gloomrel.cpp (working copy) @@ -117,17 +117,7 @@ MortalStrike_Timer = 12000; }else MortalStrike_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_golem_lord_argelmach.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_golem_lord_argelmach.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_golem_lord_argelmach.cpp (working copy) @@ -116,18 +116,7 @@ LightningShield_Timer = 45000; }else LightningShield_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_gorosh_the_dervish.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_gorosh_the_dervish.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_gorosh_the_dervish.cpp (working copy) @@ -105,17 +105,7 @@ MortalStrike_Timer = 15000; }else MortalStrike_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_grizzle.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_grizzle.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_grizzle.cpp (working copy) @@ -110,18 +110,7 @@ }else Frenzy_Timer -= diff; } - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_haterel.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_haterel.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_haterel.cpp (working copy) @@ -140,18 +140,7 @@ Strike_Timer = 10000; }else Strike_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_high_interrogator_gerstahn.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_high_interrogator_gerstahn.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_high_interrogator_gerstahn.cpp (working copy) @@ -139,18 +139,7 @@ ShadowShield_Timer = 25000; }else ShadowShield_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_lord_incendius.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_lord_incendius.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_lord_incendius.cpp (working copy) @@ -119,16 +119,7 @@ Curse_Timer = 22000; }else Curse_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_lord_roccor.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_lord_roccor.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_lord_roccor.cpp (working copy) @@ -121,18 +121,7 @@ GroundTremor_Timer = 15000; }else GroundTremor_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_magmus.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_magmus.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_magmus.cpp (working copy) @@ -109,18 +109,7 @@ }else WarStomp_Timer -= diff; } - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_pyromancer_loregrain.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_pyromancer_loregrain.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_pyromancer_loregrain.cpp (working copy) @@ -136,18 +136,7 @@ SearingTotem_Timer = 25000; }else SearingTotem_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_seethrel.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_seethrel.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_seethrel.cpp (working copy) @@ -152,16 +152,7 @@ FrostWard_Timer = 68000; }else FrostWard_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_verek.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_verek.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_verek.cpp (working copy) @@ -106,16 +106,7 @@ FrostNova_Timer = 8000; }else FrostNova_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_vilerel.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_vilerel.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_vilerel.cpp (working copy) @@ -137,17 +137,7 @@ Shield_Timer = 30000; }else Shield_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/boss_warder_stilgiss.cpp =================================================================== --- scripts/zone/blackrock_depths/boss_warder_stilgiss.cpp (revision 85) +++ scripts/zone/blackrock_depths/boss_warder_stilgiss.cpp (working copy) @@ -106,16 +106,7 @@ FrostNova_Timer = 5000; }else FrostNova_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/mob_overmaster_pyron.cpp =================================================================== --- scripts/zone/blackrock_depths/mob_overmaster_pyron.cpp (revision 85) +++ scripts/zone/blackrock_depths/mob_overmaster_pyron.cpp (working copy) @@ -107,16 +107,7 @@ FireBlast_Timer = 12000; }else FireBlast_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_depths/mob_phalanx.cpp =================================================================== --- scripts/zone/blackrock_depths/mob_phalanx.cpp (revision 85) +++ scripts/zone/blackrock_depths/mob_phalanx.cpp (working copy) @@ -123,18 +123,7 @@ MightyBlow_Timer = 10000; }else MightyBlow_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_spire/boss_drakkisath.cpp =================================================================== --- scripts/zone/blackrock_spire/boss_drakkisath.cpp (revision 85) +++ scripts/zone/blackrock_spire/boss_drakkisath.cpp (working copy) @@ -133,17 +133,7 @@ Thunderclap_Timer = 20000; }else Thunderclap_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_spire/boss_gyth.cpp =================================================================== --- scripts/zone/blackrock_spire/boss_gyth.cpp (revision 85) +++ scripts/zone/blackrock_spire/boss_gyth.cpp (working copy) @@ -109,7 +109,6 @@ if (!Aggro && Aggro_Timer < diff) { m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID,9723); // Visible now! - m_creature->m_canMove = true; m_creature->setFaction(14); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Aggro = true; @@ -118,8 +117,6 @@ if (!Event && !RootSelf) { - //Root self - m_creature->m_canMove = false; RootSelf = true; } @@ -216,7 +213,7 @@ // summon Rend and Change model to normal Gyth //Inturrupt any spell casting - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID,9806); //Gyth model m_creature->SummonCreature(10429, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,900000); SummonedRend = true; @@ -225,14 +222,9 @@ //If we are within range melee the target - if( Aggro && m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) + if( Aggro ) { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } + DoMeleeAttackIfReady(); } } } Index: scripts/zone/blackrock_spire/boss_halycon.cpp =================================================================== --- scripts/zone/blackrock_spire/boss_halycon.cpp (revision 85) +++ scripts/zone/blackrock_spire/boss_halycon.cpp (working copy) @@ -119,18 +119,7 @@ Summoned = true; } - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_spire/boss_highlord_omokk.cpp =================================================================== --- scripts/zone/blackrock_spire/boss_highlord_omokk.cpp (revision 85) +++ scripts/zone/blackrock_spire/boss_highlord_omokk.cpp (working copy) @@ -181,16 +181,7 @@ Dazed_Timer = 12000; }else Dazed_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_spire/boss_mother_smolderweb.cpp =================================================================== --- scripts/zone/blackrock_spire/boss_mother_smolderweb.cpp (revision 85) +++ scripts/zone/blackrock_spire/boss_mother_smolderweb.cpp (working copy) @@ -132,16 +132,7 @@ WebExplosion_Timer = 20000; }else WebExplosion_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_spire/boss_overlord_wyrmthalak.cpp =================================================================== --- scripts/zone/blackrock_spire/boss_overlord_wyrmthalak.cpp (revision 85) +++ scripts/zone/blackrock_spire/boss_overlord_wyrmthalak.cpp (working copy) @@ -158,18 +158,7 @@ Summoned = true; } - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_spire/boss_pyroguard_emberseer.cpp =================================================================== --- scripts/zone/blackrock_spire/boss_pyroguard_emberseer.cpp (revision 85) +++ scripts/zone/blackrock_spire/boss_pyroguard_emberseer.cpp (working copy) @@ -123,17 +123,7 @@ PyroBlast_Timer = 15000; }else PyroBlast_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_spire/boss_rend_blackhand.cpp =================================================================== --- scripts/zone/blackrock_spire/boss_rend_blackhand.cpp (revision 85) +++ scripts/zone/blackrock_spire/boss_rend_blackhand.cpp (working copy) @@ -123,17 +123,7 @@ Thunderclap_Timer = 16000; }else Thunderclap_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_spire/boss_shadow_hunter_voshgajin.cpp =================================================================== --- scripts/zone/blackrock_spire/boss_shadow_hunter_voshgajin.cpp (revision 85) +++ scripts/zone/blackrock_spire/boss_shadow_hunter_voshgajin.cpp (working copy) @@ -119,16 +119,7 @@ Cleave_Timer = 7000; }else Cleave_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_spire/boss_the_beast.cpp =================================================================== --- scripts/zone/blackrock_spire/boss_the_beast.cpp (revision 85) +++ scripts/zone/blackrock_spire/boss_the_beast.cpp (working copy) @@ -120,16 +120,7 @@ TerrifyingRoar_Timer = 20000; }else TerrifyingRoar_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_spire/boss_warmaster_voone.cpp =================================================================== --- scripts/zone/blackrock_spire/boss_warmaster_voone.cpp (revision 85) +++ scripts/zone/blackrock_spire/boss_warmaster_voone.cpp (working copy) @@ -169,16 +169,7 @@ Dazed_Timer = 24000; }else Dazed_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_spire/mob_chromatic_elite_guard.cpp =================================================================== --- scripts/zone/blackrock_spire/mob_chromatic_elite_guard.cpp (revision 85) +++ scripts/zone/blackrock_spire/mob_chromatic_elite_guard.cpp (working copy) @@ -101,17 +101,7 @@ KnockDown_Timer = 8000; }else KnockDown_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackrock_spire/mob_quartermaster_zigris.cpp =================================================================== --- scripts/zone/blackrock_spire/mob_quartermaster_zigris.cpp (revision 85) +++ scripts/zone/blackrock_spire/mob_quartermaster_zigris.cpp (working copy) @@ -118,18 +118,7 @@ Dazed_Timer = 18000; }else Dazed_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackwing_lair/boss_broodlord_lashlayer.cpp =================================================================== --- scripts/zone/blackwing_lair/boss_broodlord_lashlayer.cpp (revision 85) +++ scripts/zone/blackwing_lair/boss_broodlord_lashlayer.cpp (working copy) @@ -157,16 +157,7 @@ KnockBack_Timer = 25000; }else KnockBack_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackwing_lair/boss_chromaggus.cpp =================================================================== --- scripts/zone/blackwing_lair/boss_chromaggus.cpp (revision 85) +++ scripts/zone/blackwing_lair/boss_chromaggus.cpp (working copy) @@ -393,16 +393,7 @@ Enraged = true; } - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackwing_lair/boss_ebonroc.cpp =================================================================== --- scripts/zone/blackwing_lair/boss_ebonroc.cpp (revision 85) +++ scripts/zone/blackwing_lair/boss_ebonroc.cpp (working copy) @@ -116,16 +116,7 @@ ShadowOfEbonroc_Timer = 45000; }else ShadowOfEbonroc_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackwing_lair/boss_firemaw.cpp =================================================================== --- scripts/zone/blackwing_lair/boss_firemaw.cpp (revision 85) +++ scripts/zone/blackwing_lair/boss_firemaw.cpp (working copy) @@ -113,18 +113,8 @@ //cast this every 5 seconds FlameBuffet_Timer = 5000; }else FlameBuffet_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackwing_lair/boss_flamegor.cpp =================================================================== --- scripts/zone/blackwing_lair/boss_flamegor.cpp (revision 85) +++ scripts/zone/blackwing_lair/boss_flamegor.cpp (working copy) @@ -113,18 +113,8 @@ //cast this every 10-15 seconds Frenzy_Timer = 10000 + (rand()%5000); }else Frenzy_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackwing_lair/boss_nefarian.cpp =================================================================== --- scripts/zone/blackwing_lair/boss_nefarian.cpp (revision 85) +++ scripts/zone/blackwing_lair/boss_nefarian.cpp (working copy) @@ -313,16 +313,7 @@ DoPlaySoundToSet(m_creature,SOUND_RAISE_SKELETONS); } - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackwing_lair/boss_razorgore.cpp =================================================================== --- scripts/zone/blackwing_lair/boss_razorgore.cpp (revision 85) +++ scripts/zone/blackwing_lair/boss_razorgore.cpp (working copy) @@ -138,16 +138,7 @@ Conflagration_Timer = 30000; }else Conflagration_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackwing_lair/boss_vaelastrasz.cpp =================================================================== --- scripts/zone/blackwing_lair/boss_vaelastrasz.cpp (revision 85) +++ scripts/zone/blackwing_lair/boss_vaelastrasz.cpp (working copy) @@ -278,16 +278,7 @@ TailSwipe_Timer = 20000; }else TailSwipe_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blackwing_lair/npc_victor_nefarius.cpp =================================================================== --- scripts/zone/blackwing_lair/npc_victor_nefarius.cpp (revision 85) +++ scripts/zone/blackwing_lair/npc_victor_nefarius.cpp (working copy) @@ -297,7 +297,7 @@ //MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->CreatureRelocation(m_creature,0,0,-5000,0); //Inturrupt any spell casting - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); //Root self DoCast(m_creature,33356); Index: scripts/zone/blasted_lands/boss_kruul.cpp =================================================================== --- scripts/zone/blasted_lands/boss_kruul.cpp (revision 85) +++ scripts/zone/blasted_lands/boss_kruul.cpp (working copy) @@ -211,18 +211,7 @@ Hound_Timer = 45000; }else Hound_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/blasted_lands/mob_teremus_the_devourer.cpp =================================================================== --- scripts/zone/blasted_lands/mob_teremus_the_devourer.cpp (revision 85) +++ scripts/zone/blasted_lands/mob_teremus_the_devourer.cpp (working copy) @@ -116,16 +116,7 @@ ResistAll_Timer = 45000; }else ResistAll_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/gruuls_lair/boss_gruul.cpp =================================================================== --- scripts/zone/gruuls_lair/boss_gruul.cpp (revision 85) +++ scripts/zone/gruuls_lair/boss_gruul.cpp (working copy) @@ -171,7 +171,6 @@ { case 0: { - m_creature->m_canMove = false; IsInGroundSlam= true; // **Ground Slam Knockback** @@ -290,9 +289,6 @@ } } - //Allow movement - m_creature->m_canMove = true; - // resets everything IsInGroundSlam= false; GroundSlam_Timer =120000; @@ -305,16 +301,7 @@ } }else GroundSlam_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp =================================================================== --- scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp (revision 85) +++ scripts/zone/hellfire_peninsula/boss_doomlord_kazzak.cpp (working copy) @@ -169,17 +169,7 @@ Rage_Timer = 27000; }else Rage_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/hellfire_peninsula/mobs_bonechewer_orc.cpp =================================================================== --- scripts/zone/hellfire_peninsula/mobs_bonechewer_orc.cpp (revision 85) +++ scripts/zone/hellfire_peninsula/mobs_bonechewer_orc.cpp (working copy) @@ -66,7 +66,6 @@ DoStartMeleeAttack(who); if (!m_creature->IsWithinDistInMap(who, ATTACK_DISTANCE)) { - m_creature->m_canMove = false; IsSelfRooted = true; } @@ -91,7 +90,6 @@ DoStartMeleeAttack(who); if (!m_creature->IsWithinDistInMap(who, ATTACK_DISTANCE)) { - m_creature->m_canMove = false; IsSelfRooted = true; } @@ -146,7 +144,7 @@ if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) { //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) + if( m_creature->isAttackReady() && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { bool Healing = false; SpellEntry const *info = NULL; @@ -177,7 +175,7 @@ else { //Only run this code if we arn't already casting - if (!m_creature->m_currentSpell) + if (!m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { bool Healing = false; SpellEntry const *info = NULL; @@ -196,7 +194,6 @@ //If we are currently moving stop us and set the movement generator if (!IsSelfRooted) { - m_creature->m_canMove = false; IsSelfRooted = true; } @@ -215,8 +212,7 @@ else if (IsSelfRooted) { //Cancel our current spell and then allow movement agian - m_creature->InterruptSpell(); - m_creature->m_canMove = true; + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); IsSelfRooted = false; } } Index: scripts/zone/karazhan/boss_curator.cpp =================================================================== --- scripts/zone/karazhan/boss_curator.cpp (revision 85) +++ scripts/zone/karazhan/boss_curator.cpp (working copy) @@ -162,7 +162,7 @@ { if(m_creature->GetPower(POWER_MANA) <= 0) { - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); DoYell(SAY_EVOCATE, LANG_UNIVERSAL, NULL); DoPlaySoundToSet(m_creature, SOUND_EVOCATE); DoCast(m_creature, SPELL_EVOCATION); @@ -234,18 +234,7 @@ DoPlaySoundToSet(m_creature, SOUND_ENRAGE); } - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/karazhan/boss_maiden_of_virtue.cpp =================================================================== --- scripts/zone/karazhan/boss_maiden_of_virtue.cpp (revision 85) +++ scripts/zone/karazhan/boss_maiden_of_virtue.cpp (working copy) @@ -209,16 +209,7 @@ Divinewrath_Timer = (rand()%50)*1000; }else Divinewrath_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/karazhan/boss_prince_malchezaar.cpp =================================================================== --- scripts/zone/karazhan/boss_prince_malchezaar.cpp (revision 85) +++ scripts/zone/karazhan/boss_prince_malchezaar.cpp (working copy) @@ -570,16 +570,7 @@ } - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/maraudon/boss_landslide.cpp =================================================================== --- scripts/zone/maraudon/boss_landslide.cpp (revision 85) +++ scripts/zone/maraudon/boss_landslide.cpp (working copy) @@ -147,17 +147,7 @@ } else Adds_Timer -= diff; } - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/maraudon/boss_lord_vyletongue.cpp =================================================================== --- scripts/zone/maraudon/boss_lord_vyletongue.cpp (revision 85) +++ scripts/zone/maraudon/boss_lord_vyletongue.cpp (working copy) @@ -102,16 +102,7 @@ SmokeBomb_Timer = 12000; }else SmokeBomb_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/maraudon/boss_noxxion.cpp =================================================================== --- scripts/zone/maraudon/boss_noxxion.cpp (revision 85) +++ scripts/zone/maraudon/boss_noxxion.cpp (working copy) @@ -111,7 +111,6 @@ //Become visible again m_creature->setFaction(14); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->m_canMove = true; m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID,11172); //Noxxion model Invisible = false; } else if (Invisible) @@ -155,8 +154,7 @@ { //Inturrupt any spell casting - m_creature->InterruptSpell(); - m_creature->m_canMove = false; + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); m_creature->setFaction(35); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID,11686); // Invisible Model @@ -171,17 +169,7 @@ Adds_Timer = 40000; }else Adds_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/maraudon/boss_princess_theradras.cpp =================================================================== --- scripts/zone/maraudon/boss_princess_theradras.cpp (revision 85) +++ scripts/zone/maraudon/boss_princess_theradras.cpp (working copy) @@ -134,16 +134,7 @@ RepulsiveGaze_Timer = 20000; }else RepulsiveGaze_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/maraudon/boss_rotgrip.cpp =================================================================== --- scripts/zone/maraudon/boss_rotgrip.cpp (revision 85) +++ scripts/zone/maraudon/boss_rotgrip.cpp (working copy) @@ -90,16 +90,7 @@ Puncture_Timer = 12000; }else Puncture_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/maraudon/boss_tinkerer_gizlock.cpp =================================================================== --- scripts/zone/maraudon/boss_tinkerer_gizlock.cpp (revision 85) +++ scripts/zone/maraudon/boss_tinkerer_gizlock.cpp (working copy) @@ -105,16 +105,7 @@ Bomb_Timer = 14000; }else Bomb_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/maraudon/mob_celebras_the_cursed.cpp =================================================================== --- scripts/zone/maraudon/mob_celebras_the_cursed.cpp (revision 85) +++ scripts/zone/maraudon/mob_celebras_the_cursed.cpp (working copy) @@ -157,18 +157,7 @@ Adds_Timer = 28000; }else Adds_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/maraudon/mob_meshlok_the_harvester.cpp =================================================================== --- scripts/zone/maraudon/mob_meshlok_the_harvester.cpp (revision 85) +++ scripts/zone/maraudon/mob_meshlok_the_harvester.cpp (working copy) @@ -102,16 +102,7 @@ Strike_Timer = 9000; }else Strike_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/maraudon/mob_razorlash.cpp =================================================================== --- scripts/zone/maraudon/mob_razorlash.cpp (revision 85) +++ scripts/zone/maraudon/mob_razorlash.cpp (working copy) @@ -119,18 +119,7 @@ ThornVolley_Timer = 12000; }else ThornVolley_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/boss_baron_geddon.cpp =================================================================== --- scripts/zone/molten_core/boss_baron_geddon.cpp (revision 85) +++ scripts/zone/molten_core/boss_baron_geddon.cpp (working copy) @@ -95,7 +95,7 @@ { //If we are <2% hp cast Armageddom - if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 2 && !m_creature->m_currentSpell) + if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 2 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { DoCast(m_creature,SPELL_ARMAGEDDOM); DoTextEmote("performs one last service for Ragnaros.",NULL); @@ -139,16 +139,7 @@ LivingBomb_Timer = 35000; }else LivingBomb_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/boss_garr.cpp =================================================================== --- scripts/zone/molten_core/boss_garr.cpp (revision 85) +++ scripts/zone/molten_core/boss_garr.cpp (working copy) @@ -111,16 +111,7 @@ MagmaShackles_Timer = 15000; }else MagmaShackles_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/boss_gehennas.cpp =================================================================== --- scripts/zone/molten_core/boss_gehennas.cpp (revision 85) +++ scripts/zone/molten_core/boss_gehennas.cpp (working copy) @@ -126,16 +126,7 @@ GehennasCurse_Timer = 30000; }else GehennasCurse_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/boss_golemagg.cpp =================================================================== --- scripts/zone/molten_core/boss_golemagg.cpp (revision 85) +++ scripts/zone/molten_core/boss_golemagg.cpp (working copy) @@ -121,27 +121,16 @@ //EarthQuake_Timer if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 11 ) { - if (EarthQuake_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_EARTHQUAKE); + if (EarthQuake_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_EARTHQUAKE); - //12 seconds - EarthQuake_Timer = 12000; + //12 seconds + EarthQuake_Timer = 12000; }else EarthQuake_Timer -= diff; } - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/boss_lucifron.cpp =================================================================== --- scripts/zone/molten_core/boss_lucifron.cpp (revision 85) +++ scripts/zone/molten_core/boss_lucifron.cpp (working copy) @@ -122,16 +122,7 @@ ShadowShock_Timer = 6000; }else ShadowShock_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/boss_magmadar.cpp =================================================================== --- scripts/zone/molten_core/boss_magmadar.cpp (revision 85) +++ scripts/zone/molten_core/boss_magmadar.cpp (working copy) @@ -145,16 +145,7 @@ Lavabomb_Timer = 12000; }else Lavabomb_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/boss_majordomo_executus.cpp =================================================================== --- scripts/zone/molten_core/boss_majordomo_executus.cpp (revision 85) +++ scripts/zone/molten_core/boss_majordomo_executus.cpp (working copy) @@ -168,16 +168,7 @@ Blastwave_Timer = 10000; }else Blastwave_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/boss_ragnaros.cpp =================================================================== --- scripts/zone/molten_core/boss_ragnaros.cpp (revision 85) +++ scripts/zone/molten_core/boss_ragnaros.cpp (working copy) @@ -260,7 +260,7 @@ //is not very well supported in the core //so added normaly spawning and banish workaround and attack again after 90 secs. - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); //Root self DoCast(m_creature,23973); m_creature->setFaction(35); @@ -327,7 +327,7 @@ if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) { //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) + if( m_creature->isAttackReady() && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { m_creature->AttackerStateUpdate(m_creature->getVictim()); m_creature->resetAttackTimer(); Index: scripts/zone/molten_core/boss_shazzrah.cpp =================================================================== --- scripts/zone/molten_core/boss_shazzrah.cpp (revision 85) +++ scripts/zone/molten_core/boss_shazzrah.cpp (working copy) @@ -140,16 +140,7 @@ Countspell_Timer = 20000; }else Countspell_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/boss_sulfuron_harbinger.cpp =================================================================== --- scripts/zone/molten_core/boss_sulfuron_harbinger.cpp (revision 85) +++ scripts/zone/molten_core/boss_sulfuron_harbinger.cpp (working copy) @@ -139,16 +139,7 @@ Flamespear_Timer = 15000; }else Flamespear_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/mob_ancient_core_hound.cpp =================================================================== --- scripts/zone/molten_core/mob_ancient_core_hound.cpp (revision 85) +++ scripts/zone/molten_core/mob_ancient_core_hound.cpp (working copy) @@ -130,16 +130,7 @@ ConeOfFire_Timer = 7000; }else ConeOfFire_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/mob_core_rager.cpp =================================================================== --- scripts/zone/molten_core/mob_core_rager.cpp (revision 85) +++ scripts/zone/molten_core/mob_core_rager.cpp (working copy) @@ -108,17 +108,7 @@ Mangle_Timer = 12000; }else Mangle_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/mob_firelord.cpp =================================================================== --- scripts/zone/molten_core/mob_firelord.cpp (revision 85) +++ scripts/zone/molten_core/mob_firelord.cpp (working copy) @@ -121,17 +121,7 @@ SummonLavaSpawn_Timer = 30000; }else SummonLavaSpawn_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/mob_firesworn.cpp =================================================================== --- scripts/zone/molten_core/mob_firesworn.cpp (revision 85) +++ scripts/zone/molten_core/mob_firesworn.cpp (working copy) @@ -112,26 +112,16 @@ Immolate_Timer = 7000; }else Immolate_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; + CreatureAI* GetAI_mob_firesworn(Creature *_Creature) { return new mob_fireswornAI (_Creature); } - void AddSC_mob_firesworn() { Script *newscript; Index: scripts/zone/molten_core/mob_firewalker.cpp =================================================================== --- scripts/zone/molten_core/mob_firewalker.cpp (revision 85) +++ scripts/zone/molten_core/mob_firewalker.cpp (working copy) @@ -115,16 +115,7 @@ MeltArmor_Timer = 15000; }else MeltArmor_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/mob_flame_guard.cpp =================================================================== --- scripts/zone/molten_core/mob_flame_guard.cpp (revision 85) +++ scripts/zone/molten_core/mob_flame_guard.cpp (working copy) @@ -125,17 +125,7 @@ ConeOfFire_Timer = 11000; }else ConeOfFire_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/mob_flamewaker.cpp =================================================================== --- scripts/zone/molten_core/mob_flamewaker.cpp (revision 85) +++ scripts/zone/molten_core/mob_flamewaker.cpp (working copy) @@ -127,17 +127,7 @@ Strike_Timer = 10000; }else Strike_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/mob_flamewaker_elite.cpp =================================================================== --- scripts/zone/molten_core/mob_flamewaker_elite.cpp (revision 85) +++ scripts/zone/molten_core/mob_flamewaker_elite.cpp (working copy) @@ -122,16 +122,7 @@ Blastwave_Timer = 12000; }else Blastwave_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/mob_flamewaker_healer.cpp =================================================================== --- scripts/zone/molten_core/mob_flamewaker_healer.cpp (revision 85) +++ scripts/zone/molten_core/mob_flamewaker_healer.cpp (working copy) @@ -126,16 +126,7 @@ ShadowBolt_Timer = 2000; }else ShadowBolt_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/mob_flamewaker_protector.cpp =================================================================== --- scripts/zone/molten_core/mob_flamewaker_protector.cpp (revision 85) +++ scripts/zone/molten_core/mob_flamewaker_protector.cpp (working copy) @@ -119,16 +119,7 @@ DominateMind_Timer = 20000; }else DominateMind_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/mob_lavaspawn.cpp =================================================================== --- scripts/zone/molten_core/mob_lavaspawn.cpp (revision 85) +++ scripts/zone/molten_core/mob_lavaspawn.cpp (working copy) @@ -116,7 +116,7 @@ { //Inturrupt any spell casting - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); //Cast Split(m_creature->getVictim()); @@ -125,18 +125,7 @@ Split_Timer = 8000; }else Split_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/mob_molten_destroyer.cpp =================================================================== --- scripts/zone/molten_core/mob_molten_destroyer.cpp (revision 85) +++ scripts/zone/molten_core/mob_molten_destroyer.cpp (working copy) @@ -115,16 +115,7 @@ KnockBack_Timer = 8000; }else KnockBack_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/molten_core/mob_molten_giant.cpp =================================================================== --- scripts/zone/molten_core/mob_molten_giant.cpp (revision 85) +++ scripts/zone/molten_core/mob_molten_giant.cpp (working copy) @@ -111,16 +111,7 @@ Stomp_Timer = 12000; }else Stomp_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/naxxramas/boss_anubrekhan.cpp =================================================================== --- scripts/zone/naxxramas/boss_anubrekhan.cpp (revision 85) +++ scripts/zone/naxxramas/boss_anubrekhan.cpp (working copy) @@ -240,16 +240,7 @@ Summon_Timer = 45000; }else Summon_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/naxxramas/boss_faerlina.cpp =================================================================== --- scripts/zone/naxxramas/boss_faerlina.cpp (revision 85) +++ scripts/zone/naxxramas/boss_faerlina.cpp (working copy) @@ -232,16 +232,7 @@ Enrage_Timer = 61000; }else Enrage_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/naxxramas/boss_gluth.cpp =================================================================== --- scripts/zone/naxxramas/boss_gluth.cpp (revision 85) +++ scripts/zone/naxxramas/boss_gluth.cpp (working copy) @@ -208,18 +208,7 @@ Summon_Timer = 28000; } else Summon_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/naxxramas/boss_highlord_mograine.cpp =================================================================== --- scripts/zone/naxxramas/boss_highlord_mograine.cpp (revision 85) +++ scripts/zone/naxxramas/boss_highlord_mograine.cpp (working copy) @@ -196,16 +196,7 @@ RighteousFire_Timer = 2000; // right }else RighteousFire_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/naxxramas/boss_kelthuzad.cpp =================================================================== --- scripts/zone/naxxramas/boss_kelthuzad.cpp (revision 85) +++ scripts/zone/naxxramas/boss_kelthuzad.cpp (working copy) @@ -538,16 +538,7 @@ } else GuardiansOfIcecrown_Timer -= diff; - //Melee if we can - if(m_creature->IsWithinDistInMap(m_creature->getVictim(),ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if(m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/naxxramas/boss_lady_blaumeux.cpp =================================================================== --- scripts/zone/naxxramas/boss_lady_blaumeux.cpp (revision 85) +++ scripts/zone/naxxramas/boss_lady_blaumeux.cpp (working copy) @@ -162,16 +162,7 @@ VoidZone_Timer = 12000; // right }else VoidZone_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/naxxramas/boss_loatheb.cpp =================================================================== --- scripts/zone/naxxramas/boss_loatheb.cpp (revision 85) +++ scripts/zone/naxxramas/boss_loatheb.cpp (working copy) @@ -285,18 +285,7 @@ Summon_Timer = 28000; } else Summon_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/naxxramas/boss_maexxna.cpp =================================================================== --- scripts/zone/naxxramas/boss_maexxna.cpp (revision 85) +++ scripts/zone/naxxramas/boss_maexxna.cpp (working copy) @@ -156,16 +156,7 @@ Enraged = true; } - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/naxxramas/boss_noth.cpp =================================================================== --- scripts/zone/naxxramas/boss_noth.cpp (revision 85) +++ scripts/zone/naxxramas/boss_noth.cpp (working copy) @@ -238,18 +238,7 @@ Summon_Timer = 30500; } else Summon_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/naxxramas/boss_patchwerk.cpp =================================================================== --- scripts/zone/naxxramas/boss_patchwerk.cpp (revision 85) +++ scripts/zone/naxxramas/boss_patchwerk.cpp (working copy) @@ -185,16 +185,7 @@ Enraged = true; } - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/naxxramas/boss_razuvious.cpp =================================================================== --- scripts/zone/naxxramas/boss_razuvious.cpp (revision 85) +++ scripts/zone/naxxramas/boss_razuvious.cpp (working copy) @@ -220,16 +220,7 @@ CommandSound_Timer = 40000; }else CommandSound_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/naxxramas/boss_sir_zeliek.cpp =================================================================== --- scripts/zone/naxxramas/boss_sir_zeliek.cpp (revision 85) +++ scripts/zone/naxxramas/boss_sir_zeliek.cpp (working copy) @@ -161,16 +161,7 @@ HolyWrath_Timer = 12000; }else HolyWrath_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/naxxramas/boss_thane_korthazz.cpp =================================================================== --- scripts/zone/naxxramas/boss_thane_korthazz.cpp (revision 85) +++ scripts/zone/naxxramas/boss_thane_korthazz.cpp (working copy) @@ -163,16 +163,7 @@ Meteor_Timer = 20000; // wrong }else Meteor_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/onyxias_lair/boss_onyxia.cpp =================================================================== --- scripts/zone/onyxias_lair/boss_onyxia.cpp (revision 85) +++ scripts/zone/onyxias_lair/boss_onyxia.cpp (working copy) @@ -85,7 +85,7 @@ // m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 3); - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); m_creature->SetHover(false); (*m_creature)->Clear(false); m_creature->RemoveAllAuras(); @@ -211,7 +211,7 @@ if (movement_timer < diff) { //Inturrupt whatever we are casting then move to random position - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); uint32 position = rand()%9; switch (position) @@ -328,7 +328,7 @@ if ( phase == 1 && (m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 61) { phase = 2; - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); (*m_creature)->Clear(false); (*m_creature)->Idle(); @@ -344,7 +344,7 @@ if ( phase == 2 && (m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 41) { phase = 3; - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); SpecialMove(-65.8444,-213.809,-85.2985,5000); m_creature->Relocate(-65,-213,-85,0); //m_creature->SetUInt32Value(UNIT_NPC_EMOTESTATE,EMOTE_STATE_STAND); Index: scripts/zone/razorfen_downs/boss_amnennar_the_coldbringer.cpp =================================================================== --- scripts/zone/razorfen_downs/boss_amnennar_the_coldbringer.cpp (revision 85) +++ scripts/zone/razorfen_downs/boss_amnennar_the_coldbringer.cpp (working copy) @@ -160,16 +160,7 @@ Spectrals = true; } - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/ruins_of_ahnqiraj/boss_ayamiss.cpp =================================================================== --- scripts/zone/ruins_of_ahnqiraj/boss_ayamiss.cpp (revision 85) +++ scripts/zone/ruins_of_ahnqiraj/boss_ayamiss.cpp (working copy) @@ -90,7 +90,7 @@ } //If he is 70% start phase 2 - if (phase==1 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 70 && !m_creature->m_currentSpell) + if (phase==1 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 70 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { phase=2; @@ -119,17 +119,7 @@ SUMMONSWARMER_Timer = 60000; }else SUMMONSWARMER_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/ruins_of_ahnqiraj/boss_kurinnaxx.cpp =================================================================== --- scripts/zone/ruins_of_ahnqiraj/boss_kurinnaxx.cpp (revision 85) +++ scripts/zone/ruins_of_ahnqiraj/boss_kurinnaxx.cpp (working copy) @@ -98,7 +98,7 @@ } //If we are <30% cast enrage - if (i==0 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 30 && !m_creature->m_currentSpell) + if (i==0 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 30 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { i=1; DoCast(m_creature->getVictim(),SPELL_ENRAGE); @@ -124,18 +124,7 @@ SANDTRAP_Timer = 30000; }else SANDTRAP_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/ruins_of_ahnqiraj/boss_moam.cpp =================================================================== --- scripts/zone/ruins_of_ahnqiraj/boss_moam.cpp (revision 85) +++ scripts/zone/ruins_of_ahnqiraj/boss_moam.cpp (working copy) @@ -103,14 +103,14 @@ } //If we are 100%MANA cast Arcane Erruption - //if (j==1 && m_creature->GetMana()*100 / m_creature->GetMaxMana() == 100 && !m_creature->m_currentSpell) + //if (j==1 && m_creature->GetMana()*100 / m_creature->GetMaxMana() == 100 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { DoCast(m_creature->getVictim(),SPELL_ARCANEERUPTION); DoYell(SAY_MANA,LANG_UNIVERSAL,NULL); } //If we are <50%HP cast MANA FIEND (Summon Mana) and Sleep - //if (i==0 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50 && !m_creature->m_currentSpell) + //if (i==0 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { i=1; DoCast(m_creature->getVictim(),SPELL_SUMMONMANA); @@ -146,18 +146,7 @@ DRAINMANA_Timer = 30000; }else DRAINMANA_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scarlet_monastery/boss_arcanist_doan.cpp =================================================================== --- scripts/zone/scarlet_monastery/boss_arcanist_doan.cpp (revision 85) +++ scripts/zone/scarlet_monastery/boss_arcanist_doan.cpp (working copy) @@ -125,7 +125,7 @@ { //If we are <50% hp cast Arcane Bubble and start casting SPECIAL FIRE AOE - if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50 && !m_creature->m_currentSpell) + if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //SpecialAoE -> Fucking bitch took lot of my time to test :S if (Polymorph_Timer < diff) @@ -214,16 +214,7 @@ ManaShield4_Timer = 70000; }else ManaShield4_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scarlet_monastery/boss_azshir_the_sleepless.cpp =================================================================== --- scripts/zone/scarlet_monastery/boss_azshir_the_sleepless.cpp (revision 85) +++ scripts/zone/scarlet_monastery/boss_azshir_the_sleepless.cpp (working copy) @@ -87,7 +87,7 @@ if( m_creature->getVictim() && m_creature->isAlive()) { //If we are <50% hp cast Soul Siphon rank 1 - if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50 && !m_creature->m_currentSpell) + if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //SoulSiphon_Timer if (SoulSiphon_Timer < diff) @@ -121,16 +121,7 @@ Terrify_Timer = 20000; }else Terrify_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scarlet_monastery/boss_bloodmage_thalnos.cpp =================================================================== --- scripts/zone/scarlet_monastery/boss_bloodmage_thalnos.cpp (revision 85) +++ scripts/zone/scarlet_monastery/boss_bloodmage_thalnos.cpp (working copy) @@ -175,16 +175,7 @@ FireNova_Timer = 20000; }else FireNova_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scarlet_monastery/boss_herod.cpp =================================================================== --- scripts/zone/scarlet_monastery/boss_herod.cpp (revision 85) +++ scripts/zone/scarlet_monastery/boss_herod.cpp (working copy) @@ -153,7 +153,7 @@ { //If we are <10% hp goes Enraged - if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 10 && !m_creature->m_currentSpell && Enrage_Timer < diff) + if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 10 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL] && Enrage_Timer < diff) { DoYell(SAY_ENRAGE,LANG_UNIVERSAL,NULL); DoPlaySoundToSet(m_creature,SOUND_ENRAGE); @@ -250,16 +250,7 @@ ConeOfCold5_Timer = 40000; }else ConeOfCold5_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scarlet_monastery/boss_high_inquisitor_fairbanks.cpp =================================================================== --- scripts/zone/scarlet_monastery/boss_high_inquisitor_fairbanks.cpp (revision 85) +++ scripts/zone/scarlet_monastery/boss_high_inquisitor_fairbanks.cpp (working copy) @@ -101,7 +101,7 @@ if( m_creature->getVictim() && m_creature->isAlive()) { //If we are <45% hp cast Renew rank 6 or Flash heal rank 4 - if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 45 && !m_creature->m_currentSpell && Healing_Timer < diff) + if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 45 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL] && Healing_Timer < diff) { DoCast(m_creature->getVictim(),SPELL_RENEW6 || SPELL_FLASHHEAL4); @@ -170,16 +170,7 @@ MindBlast5_Timer = 30000; }else MindBlast5_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scarlet_monastery/boss_high_inquisitor_whitemane.cpp =================================================================== --- scripts/zone/scarlet_monastery/boss_high_inquisitor_whitemane.cpp (revision 85) +++ scripts/zone/scarlet_monastery/boss_high_inquisitor_whitemane.cpp (working copy) @@ -134,7 +134,7 @@ { //If we are <75% hp cast healing spells at self and Mograine - if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 75 && !m_creature->m_currentSpell) + if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 75 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //Healing_Timer @@ -148,7 +148,7 @@ Healing_Timer = 80000; }else Healing_Timer -= diff; - if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 30 && !m_creature->m_currentSpell) + if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 30 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { if (Healing_Timer < diff) @@ -224,16 +224,7 @@ MindBlast6_Timer = 35000; }else MindBlast6_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scarlet_monastery/boss_houndmaster_loksey.cpp =================================================================== --- scripts/zone/scarlet_monastery/boss_houndmaster_loksey.cpp (revision 85) +++ scripts/zone/scarlet_monastery/boss_houndmaster_loksey.cpp (working copy) @@ -99,7 +99,7 @@ if( m_creature->getVictim() && m_creature->isAlive()) { //If we are <10% hp cast healing spells at self and Mograine - if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 10 && !m_creature->m_currentSpell && Enrage_Timer < diff) + if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 10 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL] && Enrage_Timer < diff) { DoCast(m_creature,SPELL_ENRAGE); @@ -108,16 +108,7 @@ }else Enrage_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scarlet_monastery/boss_interrogator_vishas.cpp =================================================================== --- scripts/zone/scarlet_monastery/boss_interrogator_vishas.cpp (revision 85) +++ scripts/zone/scarlet_monastery/boss_interrogator_vishas.cpp (working copy) @@ -104,7 +104,7 @@ } //If we are low on hp Do sayings - if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 60 && !m_creature->m_currentSpell) + if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 60 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //Yell_Timer if (Yell_Timer < diff) @@ -119,7 +119,7 @@ }else Yell_Timer -= diff; } - if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 30 && !m_creature->m_currentSpell) + if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 30 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //Yell_Timer if (Yell_Timer < diff) @@ -144,16 +144,7 @@ PowerWordShield_Timer = 60000; }else PowerWordShield_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scarlet_monastery/boss_scarlet_commander_mograine.cpp =================================================================== --- scripts/zone/scarlet_monastery/boss_scarlet_commander_mograine.cpp (revision 85) +++ scripts/zone/scarlet_monastery/boss_scarlet_commander_mograine.cpp (working copy) @@ -115,7 +115,7 @@ if( m_creature->getVictim() && m_creature->isAlive()) { //If we are <50% hp cast Arcane Bubble and start casting SPECIAL Arcane Explosion - if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50 && !m_creature->m_currentSpell) + if ( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //heal_Timer @@ -201,16 +201,7 @@ BlessingOfProtection3_Timer = 50000; }else BlessingOfProtection3_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scarlet_monastery/boss_scorn.cpp =================================================================== --- scripts/zone/scarlet_monastery/boss_scorn.cpp (revision 85) +++ scripts/zone/scarlet_monastery/boss_scorn.cpp (working copy) @@ -128,16 +128,7 @@ FrostNova_Timer = 15000; }else FrostNova_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scarlet_monastery/mob_scarlet_torturer.cpp =================================================================== --- scripts/zone/scarlet_monastery/mob_scarlet_torturer.cpp (revision 85) +++ scripts/zone/scarlet_monastery/mob_scarlet_torturer.cpp (working copy) @@ -126,16 +126,7 @@ Immolate_Timer = 45000; }else Immolate_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scholomance/boss_doctor_theolen_krastinov.cpp =================================================================== --- scripts/zone/scholomance/boss_doctor_theolen_krastinov.cpp (revision 85) +++ scripts/zone/scholomance/boss_doctor_theolen_krastinov.cpp (working copy) @@ -120,18 +120,7 @@ }else Frenzy_Timer -= diff; } - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scholomance/boss_illucia_barov.cpp =================================================================== --- scripts/zone/scholomance/boss_illucia_barov.cpp (revision 85) +++ scripts/zone/scholomance/boss_illucia_barov.cpp (working copy) @@ -133,17 +133,7 @@ Fear_Timer = 30000; }else Fear_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scholomance/boss_instructor_malicia.cpp =================================================================== --- scripts/zone/scholomance/boss_instructor_malicia.cpp (revision 85) +++ scripts/zone/scholomance/boss_instructor_malicia.cpp (working copy) @@ -173,17 +173,7 @@ }else HealingTouch_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scholomance/boss_jandice_barov.cpp =================================================================== --- scripts/zone/scholomance/boss_jandice_barov.cpp (revision 85) +++ scripts/zone/scholomance/boss_jandice_barov.cpp (working copy) @@ -110,7 +110,6 @@ m_creature->setFaction(14); m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID,11073); //Jandice Model - m_creature->m_canMove = true; Invisible = false; } else if (Invisible) { @@ -142,8 +141,7 @@ { //Inturrupt any spell casting - m_creature->InterruptSpell(); - m_creature->m_canMove = false; + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); m_creature->setFaction(35); m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID,11686); // Invisible Model @@ -186,18 +184,7 @@ // // }else Illusion_Timer -= diff; - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scholomance/boss_kormok.cpp =================================================================== --- scripts/zone/scholomance/boss_kormok.cpp (revision 85) +++ scripts/zone/scholomance/boss_kormok.cpp (working copy) @@ -185,16 +185,7 @@ Mages = true; } - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scholomance/boss_lord_alexei_barov.cpp =================================================================== --- scripts/zone/scholomance/boss_lord_alexei_barov.cpp (revision 85) +++ scripts/zone/scholomance/boss_lord_alexei_barov.cpp (working copy) @@ -121,16 +121,7 @@ VeilofShadow_Timer = 25000; }else VeilofShadow_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scholomance/boss_lorekeeper_polkelt.cpp =================================================================== --- scripts/zone/scholomance/boss_lorekeeper_polkelt.cpp (revision 85) +++ scripts/zone/scholomance/boss_lorekeeper_polkelt.cpp (working copy) @@ -125,16 +125,7 @@ NoxiousCatalyst_Timer = 38000; }else NoxiousCatalyst_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scholomance/boss_ras_frostwhisper.cpp =================================================================== --- scripts/zone/scholomance/boss_ras_frostwhisper.cpp (revision 85) +++ scripts/zone/scholomance/boss_ras_frostwhisper.cpp (working copy) @@ -161,16 +161,7 @@ FrostVolley_Timer = 15000; }else FrostVolley_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scholomance/boss_the_ravenian.cpp =================================================================== --- scripts/zone/scholomance/boss_the_ravenian.cpp (revision 85) +++ scripts/zone/scholomance/boss_the_ravenian.cpp (working copy) @@ -139,16 +139,7 @@ KnockAway_Timer = 12000; }else KnockAway_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/scholomance/boss_vectus.cpp =================================================================== --- scripts/zone/scholomance/boss_vectus.cpp (revision 85) +++ scripts/zone/scholomance/boss_vectus.cpp (working copy) @@ -120,17 +120,7 @@ }else Frenzy_Timer -= diff; } - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_archivist_galford.cpp =================================================================== --- scripts/zone/stratholme/boss_archivist_galford.cpp (revision 85) +++ scripts/zone/stratholme/boss_archivist_galford.cpp (working copy) @@ -122,16 +122,7 @@ Pyroblast_Timer = 21000; }else Pyroblast_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_baron_rivendare.cpp =================================================================== --- scripts/zone/stratholme/boss_baron_rivendare.cpp (revision 85) +++ scripts/zone/stratholme/boss_baron_rivendare.cpp (working copy) @@ -256,17 +256,7 @@ SummonSkeletons_Timer = 40000; }else SummonSkeletons_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_baroness_anastari.cpp =================================================================== --- scripts/zone/stratholme/boss_baroness_anastari.cpp (revision 85) +++ scripts/zone/stratholme/boss_baroness_anastari.cpp (working copy) @@ -140,16 +140,8 @@ Possess_Timer = 50000; }else Possess_Timer -= diff; */ - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_black_guard_swordsmith.cpp =================================================================== --- scripts/zone/stratholme/boss_black_guard_swordsmith.cpp (revision 85) +++ scripts/zone/stratholme/boss_black_guard_swordsmith.cpp (working copy) @@ -112,16 +112,7 @@ BansheeCurse_Timer = 15000; }else BansheeCurse_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_cannon_master_willey.cpp =================================================================== --- scripts/zone/stratholme/boss_cannon_master_willey.cpp (revision 85) +++ scripts/zone/stratholme/boss_cannon_master_willey.cpp (working copy) @@ -234,17 +234,7 @@ SummonRifleman_Timer = 30000; }else SummonRifleman_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_crimson_hammersmith.cpp =================================================================== --- scripts/zone/stratholme/boss_crimson_hammersmith.cpp (revision 85) +++ scripts/zone/stratholme/boss_crimson_hammersmith.cpp (working copy) @@ -125,16 +125,7 @@ HammerOfJustice_Timer = 16000; }else HammerOfJustice_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_dathrohan_balnazzar.cpp =================================================================== --- scripts/zone/stratholme/boss_dathrohan_balnazzar.cpp (revision 85) +++ scripts/zone/stratholme/boss_dathrohan_balnazzar.cpp (working copy) @@ -159,7 +159,7 @@ if (!Transformed) { //CrusadersHammer - if (CrusadersHammer_Timer < diff && !m_creature->m_currentSpell) + if (CrusadersHammer_Timer < diff && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //Cast if (rand()%100 < 50) //50% chance to cast @@ -171,7 +171,7 @@ }else CrusadersHammer_Timer -= diff; //CrusaderStrike - if (CrusaderStrike_Timer < diff && !m_creature->m_currentSpell) + if (CrusaderStrike_Timer < diff && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //Cast if (rand()%100 < 50) //50% chance to cast @@ -183,7 +183,7 @@ }else CrusaderStrike_Timer -= diff; //MindBlast - if (MindBlast_Timer < diff && !m_creature->m_currentSpell) + if (MindBlast_Timer < diff && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //Cast if (rand()%100 < 50) //50% chance to cast @@ -195,7 +195,7 @@ }else MindBlast_Timer -= diff; //HolyStrike - if (HolyStrike_Timer < diff && !m_creature->m_currentSpell) + if (HolyStrike_Timer < diff && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //Cast if (rand()%100 < 50) //50% chance to cast @@ -207,7 +207,7 @@ }else HolyStrike_Timer -= diff; //Dazed - if (Dazed_Timer < diff && !m_creature->m_currentSpell) + if (Dazed_Timer < diff && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //Cast if (rand()%100 < 50) //50% chance to cast @@ -232,7 +232,7 @@ } else { //ShadowShock - if (ShadowShock_Timer < diff && !m_creature->m_currentSpell) + if (ShadowShock_Timer < diff && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //Cast if (rand()%100 < 50) //50% chance to cast @@ -244,7 +244,7 @@ }else ShadowShock_Timer -= diff; //PsychicScream - if (PsychicScream_Timer < diff && !m_creature->m_currentSpell) + if (PsychicScream_Timer < diff && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //Cast if (rand()%100 < 50) //50% chance to cast @@ -256,7 +256,7 @@ }else PsychicScream_Timer -= diff; //DeepSleep - if (DeepSleep_Timer < diff && !m_creature->m_currentSpell) + if (DeepSleep_Timer < diff && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //Cast if (rand()%100 < 50) //50% chance to cast @@ -268,7 +268,7 @@ }else DeepSleep_Timer -= diff; //ShadowBoltVolley - if (ShadowBoltVolley_Timer < diff && !m_creature->m_currentSpell) + if (ShadowBoltVolley_Timer < diff && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { //Cast if (rand()%100 < 50) //50% chance to cast @@ -294,16 +294,7 @@ //END ELSE TRANSFORMED } - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_fras_siabi.cpp =================================================================== --- scripts/zone/stratholme/boss_fras_siabi.cpp (revision 85) +++ scripts/zone/stratholme/boss_fras_siabi.cpp (working copy) @@ -139,16 +139,7 @@ DemoralizingShout_Timer = 20000; }else DemoralizingShout_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_hearthsinger_forresten.cpp =================================================================== --- scripts/zone/stratholme/boss_hearthsinger_forresten.cpp (revision 85) +++ scripts/zone/stratholme/boss_hearthsinger_forresten.cpp (working copy) @@ -108,16 +108,7 @@ Shoot_Timer = 3000; }else Shoot_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_magistrate_barthilas.cpp =================================================================== --- scripts/zone/stratholme/boss_magistrate_barthilas.cpp (revision 85) +++ scripts/zone/stratholme/boss_magistrate_barthilas.cpp (working copy) @@ -130,16 +130,7 @@ Dazed_Timer = 20000; }else Dazed_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_maleki_the_pallid.cpp =================================================================== --- scripts/zone/stratholme/boss_maleki_the_pallid.cpp (revision 85) +++ scripts/zone/stratholme/boss_maleki_the_pallid.cpp (working copy) @@ -135,16 +135,7 @@ DrainLife_Timer = 31000; }else DrainLife_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_malor_the_zealous.cpp =================================================================== --- scripts/zone/stratholme/boss_malor_the_zealous.cpp (revision 85) +++ scripts/zone/stratholme/boss_malor_the_zealous.cpp (working copy) @@ -105,16 +105,7 @@ } } - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_nerubenkan.cpp =================================================================== --- scripts/zone/stratholme/boss_nerubenkan.cpp (revision 85) +++ scripts/zone/stratholme/boss_nerubenkan.cpp (working copy) @@ -152,16 +152,7 @@ RaiseUndeadScarab_Timer = 16000; }else RaiseUndeadScarab_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_postmaster_malown.cpp =================================================================== --- scripts/zone/stratholme/boss_postmaster_malown.cpp (revision 85) +++ scripts/zone/stratholme/boss_postmaster_malown.cpp (working copy) @@ -167,16 +167,7 @@ CallOfTheGrave_Timer = 25000; }else CallOfTheGrave_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_ramstein_the_gorger.cpp =================================================================== --- scripts/zone/stratholme/boss_ramstein_the_gorger.cpp (revision 85) +++ scripts/zone/stratholme/boss_ramstein_the_gorger.cpp (working copy) @@ -108,16 +108,7 @@ Knockout_Timer = 10000; }else Knockout_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_skul.cpp =================================================================== --- scripts/zone/stratholme/boss_skul.cpp (revision 85) +++ scripts/zone/stratholme/boss_skul.cpp (working copy) @@ -136,16 +136,7 @@ ArcaneBolt_Timer = 11000; }else ArcaneBolt_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_stonespine.cpp =================================================================== --- scripts/zone/stratholme/boss_stonespine.cpp (revision 85) +++ scripts/zone/stratholme/boss_stonespine.cpp (working copy) @@ -121,16 +121,7 @@ DeafeningScreech_Timer = 18000; }else DeafeningScreech_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_the_unforgiven.cpp =================================================================== --- scripts/zone/stratholme/boss_the_unforgiven.cpp (revision 85) +++ scripts/zone/stratholme/boss_the_unforgiven.cpp (working copy) @@ -108,16 +108,7 @@ Chilled_Timer = 14000; }else Chilled_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/boss_timmy_the_cruel.cpp =================================================================== --- scripts/zone/stratholme/boss_timmy_the_cruel.cpp (revision 85) +++ scripts/zone/stratholme/boss_timmy_the_cruel.cpp (working copy) @@ -101,16 +101,7 @@ RavenousClaw_Timer = 15000; }else RavenousClaw_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_bile_slime.cpp =================================================================== --- scripts/zone/stratholme/mob_bile_slime.cpp (revision 85) +++ scripts/zone/stratholme/mob_bile_slime.cpp (working copy) @@ -122,16 +122,7 @@ SlowingPoison_Timer = 15000; }else SlowingPoison_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_bile_spewer.cpp =================================================================== --- scripts/zone/stratholme/mob_bile_spewer.cpp (revision 85) +++ scripts/zone/stratholme/mob_bile_spewer.cpp (working copy) @@ -141,16 +141,7 @@ SpawnBileSlime_Timer = 15000; }else SpawnBileSlime_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_black_guard_sentry.cpp =================================================================== --- scripts/zone/stratholme/mob_black_guard_sentry.cpp (revision 85) +++ scripts/zone/stratholme/mob_black_guard_sentry.cpp (working copy) @@ -124,16 +124,7 @@ Dazed_Timer = 19000; }else Dazed_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_broken_cadaver.cpp =================================================================== --- scripts/zone/stratholme/mob_broken_cadaver.cpp (revision 85) +++ scripts/zone/stratholme/mob_broken_cadaver.cpp (working copy) @@ -104,16 +104,7 @@ DoCast(m_creature,SPELL_EXPLODINGCADAVER); }else ExplodingCadaver_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_crimson_battle_mage.cpp =================================================================== --- scripts/zone/stratholme/mob_crimson_battle_mage.cpp (revision 85) +++ scripts/zone/stratholme/mob_crimson_battle_mage.cpp (working copy) @@ -118,16 +118,7 @@ Immolate_Timer = 23000; }else Immolate_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_crimson_conjuror.cpp =================================================================== --- scripts/zone/stratholme/mob_crimson_conjuror.cpp (revision 85) +++ scripts/zone/stratholme/mob_crimson_conjuror.cpp (working copy) @@ -131,16 +131,7 @@ SummonWaterElemental_Timer = 70000; }else SummonWaterElemental_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_crimson_defender.cpp =================================================================== --- scripts/zone/stratholme/mob_crimson_defender.cpp (revision 85) +++ scripts/zone/stratholme/mob_crimson_defender.cpp (working copy) @@ -125,16 +125,7 @@ BubbleBoy = true; } - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_crimson_gallant.cpp =================================================================== --- scripts/zone/stratholme/mob_crimson_gallant.cpp (revision 85) +++ scripts/zone/stratholme/mob_crimson_gallant.cpp (working copy) @@ -118,16 +118,7 @@ CrusaderStrike_Timer = 8000; }else CrusaderStrike_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_crimson_guardsman.cpp =================================================================== --- scripts/zone/stratholme/mob_crimson_guardsman.cpp (revision 85) +++ scripts/zone/stratholme/mob_crimson_guardsman.cpp (working copy) @@ -130,16 +130,7 @@ KnockAway_Timer = 19000; }else KnockAway_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_crimson_initiate.cpp =================================================================== --- scripts/zone/stratholme/mob_crimson_initiate.cpp (revision 85) +++ scripts/zone/stratholme/mob_crimson_initiate.cpp (working copy) @@ -124,16 +124,7 @@ Renew_Timer = 12000; }else Renew_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_crimson_inquisitor.cpp =================================================================== --- scripts/zone/stratholme/mob_crimson_inquisitor.cpp (revision 85) +++ scripts/zone/stratholme/mob_crimson_inquisitor.cpp (working copy) @@ -122,16 +122,7 @@ ManaBurn_Timer = 29000; }else ManaBurn_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_crimson_monk.cpp =================================================================== --- scripts/zone/stratholme/mob_crimson_monk.cpp (revision 85) +++ scripts/zone/stratholme/mob_crimson_monk.cpp (working copy) @@ -100,16 +100,7 @@ SnapKick_Timer = 9000; }else SnapKick_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_crimson_priest.cpp =================================================================== --- scripts/zone/stratholme/mob_crimson_priest.cpp (revision 85) +++ scripts/zone/stratholme/mob_crimson_priest.cpp (working copy) @@ -124,16 +124,7 @@ HolyLight_Timer = 15000; } else HolyLight_Timer-=diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_crimson_rifleman.cpp =================================================================== --- scripts/zone/stratholme/mob_crimson_rifleman.cpp (revision 85) +++ scripts/zone/stratholme/mob_crimson_rifleman.cpp (working copy) @@ -94,7 +94,6 @@ //Lock our position if (!Rooted) { - m_creature->m_canMove = false; Rooted = true; } DoCast(m_creature->getVictim(),SPELL_SHOOT); @@ -103,22 +102,12 @@ else if (Rooted && !CanCast(m_creature->getVictim(),Shoot_S)) { - m_creature->m_canMove = true; Rooted = false; } - Shoot_Timer -= diff; + Shoot_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_crimson_sorcerer.cpp =================================================================== --- scripts/zone/stratholme/mob_crimson_sorcerer.cpp (revision 85) +++ scripts/zone/stratholme/mob_crimson_sorcerer.cpp (working copy) @@ -139,16 +139,7 @@ FireBlast_Timer = 19000; }else FireBlast_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_crypt_beast.cpp =================================================================== --- scripts/zone/stratholme/mob_crypt_beast.cpp (revision 85) +++ scripts/zone/stratholme/mob_crypt_beast.cpp (working copy) @@ -132,16 +132,7 @@ DeafeningScreech_Timer = 32000; }else DeafeningScreech_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_crypt_crawler.cpp =================================================================== --- scripts/zone/stratholme/mob_crypt_crawler.cpp (revision 85) +++ scripts/zone/stratholme/mob_crypt_crawler.cpp (working copy) @@ -120,16 +120,7 @@ DeafeningScreech_Timer = 32000; }else DeafeningScreech_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_eye_of_naxxramas.cpp =================================================================== --- scripts/zone/stratholme/mob_eye_of_naxxramas.cpp (revision 85) +++ scripts/zone/stratholme/mob_eye_of_naxxramas.cpp (working copy) @@ -153,16 +153,7 @@ } }else SummonRockwingGargoyles_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_fleshflayer_ghoul.cpp =================================================================== --- scripts/zone/stratholme/mob_fleshflayer_ghoul.cpp (revision 85) +++ scripts/zone/stratholme/mob_fleshflayer_ghoul.cpp (working copy) @@ -136,16 +136,7 @@ GhoulPlague_Timer = 11000; }else GhoulPlague_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_freed_soul.cpp =================================================================== --- scripts/zone/stratholme/mob_freed_soul.cpp (revision 85) +++ scripts/zone/stratholme/mob_freed_soul.cpp (working copy) @@ -80,17 +80,7 @@ //Check if we have a current target if( m_creature->getVictim() && m_creature->isAlive()) { - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_ghostly_citizen.cpp =================================================================== --- scripts/zone/stratholme/mob_ghostly_citizen.cpp (revision 85) +++ scripts/zone/stratholme/mob_ghostly_citizen.cpp (working copy) @@ -136,16 +136,7 @@ Dazed_Timer = 15000; }else Dazed_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_ghoul_ravener.cpp =================================================================== --- scripts/zone/stratholme/mob_ghoul_ravener.cpp (revision 85) +++ scripts/zone/stratholme/mob_ghoul_ravener.cpp (working copy) @@ -152,16 +152,7 @@ GhoulPlague_Timer = 14000; }else GhoulPlague_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_mangled_cadaver.cpp =================================================================== --- scripts/zone/stratholme/mob_mangled_cadaver.cpp (revision 85) +++ scripts/zone/stratholme/mob_mangled_cadaver.cpp (working copy) @@ -125,16 +125,7 @@ CadaverWorms_Timer = 21000; }else CadaverWorms_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_mindless_skeleton.cpp =================================================================== --- scripts/zone/stratholme/mob_mindless_skeleton.cpp (revision 85) +++ scripts/zone/stratholme/mob_mindless_skeleton.cpp (working copy) @@ -94,16 +94,7 @@ Dazed_Timer = 10000; }else Dazed_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_patchwork_horror.cpp =================================================================== --- scripts/zone/stratholme/mob_patchwork_horror.cpp (revision 85) +++ scripts/zone/stratholme/mob_patchwork_horror.cpp (working copy) @@ -138,16 +138,7 @@ WeakenedSoul_Timer = 18000; }else WeakenedSoul_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_plague_ghoul.cpp =================================================================== --- scripts/zone/stratholme/mob_plague_ghoul.cpp (revision 85) +++ scripts/zone/stratholme/mob_plague_ghoul.cpp (working copy) @@ -156,16 +156,7 @@ GhoulPlague_Timer = 15000; }else GhoulPlague_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_ravaged_cadaver.cpp =================================================================== --- scripts/zone/stratholme/mob_ravaged_cadaver.cpp (revision 85) +++ scripts/zone/stratholme/mob_ravaged_cadaver.cpp (working copy) @@ -173,16 +173,7 @@ SummonBrokenCadaver_Timer = 35000; }else SummonBrokenCadaver_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_restless_soul.cpp =================================================================== --- scripts/zone/stratholme/mob_restless_soul.cpp (revision 85) +++ scripts/zone/stratholme/mob_restless_soul.cpp (working copy) @@ -105,18 +105,7 @@ //Check if we have a current target if( m_creature->getVictim() && m_creature->isAlive()) { - - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_rockwing_gargoyle.cpp =================================================================== --- scripts/zone/stratholme/mob_rockwing_gargoyle.cpp (revision 85) +++ scripts/zone/stratholme/mob_rockwing_gargoyle.cpp (working copy) @@ -139,16 +139,7 @@ DeafeningScreech_Timer = 21000; }else DeafeningScreech_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_rockwing_screecher.cpp =================================================================== --- scripts/zone/stratholme/mob_rockwing_screecher.cpp (revision 85) +++ scripts/zone/stratholme/mob_rockwing_screecher.cpp (working copy) @@ -169,16 +169,7 @@ DemoralizingShout_Timer = 20000; }else DemoralizingShout_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_shrieking_banshee.cpp =================================================================== --- scripts/zone/stratholme/mob_shrieking_banshee.cpp (revision 85) +++ scripts/zone/stratholme/mob_shrieking_banshee.cpp (working copy) @@ -120,16 +120,7 @@ DeafeningScreech_Timer = 23000; }else DeafeningScreech_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_skeletal_berserker.cpp =================================================================== --- scripts/zone/stratholme/mob_skeletal_berserker.cpp (revision 85) +++ scripts/zone/stratholme/mob_skeletal_berserker.cpp (working copy) @@ -169,16 +169,7 @@ Hamstring_Timer = 23000; }else Hamstring_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_skeletal_guardian.cpp =================================================================== --- scripts/zone/stratholme/mob_skeletal_guardian.cpp (revision 85) +++ scripts/zone/stratholme/mob_skeletal_guardian.cpp (working copy) @@ -148,16 +148,7 @@ ArcaneExplosion_Timer = 16000; }else ArcaneExplosion_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_spectral_citizen.cpp =================================================================== --- scripts/zone/stratholme/mob_spectral_citizen.cpp (revision 85) +++ scripts/zone/stratholme/mob_spectral_citizen.cpp (working copy) @@ -151,16 +151,7 @@ DemoralizingShout_Timer = 20000; }else DemoralizingShout_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_spiteful_phantom.cpp =================================================================== --- scripts/zone/stratholme/mob_spiteful_phantom.cpp (revision 85) +++ scripts/zone/stratholme/mob_spiteful_phantom.cpp (working copy) @@ -139,16 +139,7 @@ HauntingPhantoms_Timer = 24000; }else HauntingPhantoms_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_thuzadin_acolyte.cpp =================================================================== --- scripts/zone/stratholme/mob_thuzadin_acolyte.cpp (revision 85) +++ scripts/zone/stratholme/mob_thuzadin_acolyte.cpp (working copy) @@ -94,16 +94,7 @@ Dazed_Timer = 17000; }else Dazed_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_thuzadin_necromancer.cpp =================================================================== --- scripts/zone/stratholme/mob_thuzadin_necromancer.cpp (revision 85) +++ scripts/zone/stratholme/mob_thuzadin_necromancer.cpp (working copy) @@ -115,16 +115,7 @@ BoneArmor_Timer = 120000; }else BoneArmor_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_thuzadin_shadowcaster.cpp =================================================================== --- scripts/zone/stratholme/mob_thuzadin_shadowcaster.cpp (revision 85) +++ scripts/zone/stratholme/mob_thuzadin_shadowcaster.cpp (working copy) @@ -121,16 +121,7 @@ PiercingShadow_Timer = 45000; }else PiercingShadow_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_undead_scarab.cpp =================================================================== --- scripts/zone/stratholme/mob_undead_scarab.cpp (revision 85) +++ scripts/zone/stratholme/mob_undead_scarab.cpp (working copy) @@ -104,16 +104,7 @@ Dazed_Timer = 16000; }else Dazed_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_vengeful_phantom.cpp =================================================================== --- scripts/zone/stratholme/mob_vengeful_phantom.cpp (revision 85) +++ scripts/zone/stratholme/mob_vengeful_phantom.cpp (working copy) @@ -124,16 +124,7 @@ FrostShock_Timer = 15000; }else FrostShock_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_venom_belcher.cpp =================================================================== --- scripts/zone/stratholme/mob_venom_belcher.cpp (revision 85) +++ scripts/zone/stratholme/mob_venom_belcher.cpp (working copy) @@ -122,16 +122,7 @@ SlowingPoison_Timer = 35000; }else SlowingPoison_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_wailing_banshee.cpp =================================================================== --- scripts/zone/stratholme/mob_wailing_banshee.cpp (revision 85) +++ scripts/zone/stratholme/mob_wailing_banshee.cpp (working copy) @@ -151,16 +151,7 @@ SoulTap_Timer = 19000; }else SoulTap_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/stratholme/mob_wrath_phantom.cpp =================================================================== --- scripts/zone/stratholme/mob_wrath_phantom.cpp (revision 85) +++ scripts/zone/stratholme/mob_wrath_phantom.cpp (working copy) @@ -124,16 +124,7 @@ HauntingPhantoms_Timer = 13000; }else HauntingPhantoms_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp =================================================================== --- scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp (revision 85) +++ scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp (working copy) @@ -192,7 +192,7 @@ target = SelectUnit(SELECT_TARGET_RANDOM,0); if (target) { - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); DoCast(target,SPELL_GREEN_BEAM); //Correctly update our target m_creature->SetUInt64Value(UNIT_FIELD_TARGET, target->GetGUID()); @@ -249,7 +249,7 @@ //Switch to Dark Beam Phase = 1; - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); //Select random target for dark beam to start on Unit* target = NULL; @@ -294,7 +294,7 @@ EyeTentacleTimer = 45000; //Always spawns 5 seconds before Dark Beam ClawTentacleTimer = 12500; //4 per Eye beam phase (unsure if they spawn durring Dark beam) - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); //Remove Red coloration from c'thun m_creature->RemoveAurasDueToSpell(SPELL_RED_COLORATION); @@ -446,16 +446,7 @@ HamstringTimer = 5000; }else HamstringTimer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } }; Index: scripts/zone/temple_of_ahnqiraj/boss_huhuran.cpp =================================================================== --- scripts/zone/temple_of_ahnqiraj/boss_huhuran.cpp (revision 85) +++ scripts/zone/temple_of_ahnqiraj/boss_huhuran.cpp (working copy) @@ -124,21 +124,12 @@ phase = 2; }else Poison_Timer -= diff; - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); if ( (phase == 2 || phase == 1) && (m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 30) { phase = 3; - m_creature->InterruptSpell(); + m_creature->InterruptSpell(CURRENT_GENERIC_SPELL); DoTextEmote("is going berserk", NULL); DoCast(m_creature, SPELL_BERSERK); } Index: scripts/zone/temple_of_ahnqiraj/boss_sartura.cpp =================================================================== --- scripts/zone/temple_of_ahnqiraj/boss_sartura.cpp (revision 85) +++ scripts/zone/temple_of_ahnqiraj/boss_sartura.cpp (working copy) @@ -83,7 +83,7 @@ } //If he is 20% enrage - if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 20 && !m_creature->m_currentSpell) + if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 20 && !m_creature->m_currentSpells[CURRENT_GENERIC_SPELL]) { DoCast(m_creature->getVictim(),SPELL_ENRAGE); } @@ -97,17 +97,7 @@ WHIRLWIND_Timer = 30000; }else WHIRLWIND_Timer -= diff; - - //If we are within range melee the target - if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) - { - //Make sure our attack is ready and we arn't currently casting - if( m_creature->isAttackReady() && !m_creature->m_currentSpell) - { - m_creature->AttackerStateUpdate(m_creature->getVictim()); - m_creature->resetAttackTimer(); - } - } + DoMeleeAttackIfReady(); } } };