*code cleanup

*totally destroyed m_creature, use "me" for future coding

--HG--
branch : trunk
This commit is contained in:
Rat
2010-04-14 23:07:41 +02:00
parent cc262e1cde
commit 6bcb297de4
403 changed files with 9851 additions and 9852 deletions
+2 -2
View File
@@ -152,7 +152,7 @@ void CreatureAI::EnterEvadeMode()
if (Unit *owner = me->GetCharmerOrOwner())
{
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, m_creature->GetFollowAngle(), MOTION_SLOT_ACTIVE);
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE);
}
else
me->GetMotionMaster()->MoveTargetedHome();
@@ -166,6 +166,6 @@ void CreatureAI::EnterEvadeMode()
/*void CreatureAI::AttackedBy(Unit* attacker)
{
if (!m_creature->getVictim())
if (!me->getVictim())
AttackStart(attacker);
}*/
+2 -3
View File
@@ -68,7 +68,6 @@ class CreatureAI : public UnitAI
{
protected:
Creature * const me;
Creature * const m_creature;
bool UpdateVictim();
bool UpdateVictimWithGaze();
@@ -83,7 +82,7 @@ class CreatureAI : public UnitAI
Creature *DoSummonFlyer(uint32 uiEntry, WorldObject *obj, float fZ, float fRadius = 5.0f, uint32 uiDespawntime = 30000, TempSummonType uiType = TEMPSUMMON_CORPSE_TIMED_DESPAWN);
public:
explicit CreatureAI(Creature *c) : UnitAI((Unit*)c), me(c), m_creature(c), m_MoveInLineOfSight_locked(false) {}
explicit CreatureAI(Creature *c) : UnitAI((Unit*)c), me(c), m_MoveInLineOfSight_locked(false) {}
virtual ~CreatureAI() {}
@@ -169,7 +168,7 @@ class CreatureAI : public UnitAI
/// == Fields =======================================
// Pointer to controlled by AI creature
//Creature* const m_creature;
//Creature* const me;
virtual void PassengerBoarded(Unit *who, int8 seatId, bool apply) {}
+141 -141
View File
@@ -59,7 +59,7 @@ int CreatureEventAI::Permissible(const Creature *creature)
CreatureEventAI::CreatureEventAI(Creature *c) : CreatureAI(c)
{
// Need make copy for filter unneeded steps and safe in case table reload
CreatureEventAI_Event_Map::const_iterator CreatureEvents = CreatureEAI_Mgr.GetCreatureEventAIMap().find(m_creature->GetEntry());
CreatureEventAI_Event_Map::const_iterator CreatureEvents = CreatureEAI_Mgr.GetCreatureEventAIMap().find(me->GetEntry());
if (CreatureEvents != CreatureEAI_Mgr.GetCreatureEventAIMap().end())
{
std::vector<CreatureEventAI_Event>::const_iterator i;
@@ -71,9 +71,9 @@ CreatureEventAI::CreatureEventAI(Creature *c) : CreatureAI(c)
if ((*i).event_flags & EFLAG_DEBUG_ONLY)
continue;
#endif
if (m_creature->GetMap()->IsDungeon())
if (me->GetMap()->IsDungeon())
{
if ((1 << (m_creature->GetMap()->GetSpawnMode()+1)) & (*i).event_flags)
if ((1 << (me->GetMap()->GetSpawnMode()+1)) & (*i).event_flags)
{
//event flagged for instance mode
CreatureEventAIList.push_back(CreatureEventAIHolder(*i));
@@ -84,10 +84,10 @@ CreatureEventAI::CreatureEventAI(Creature *c) : CreatureAI(c)
}
//EventMap had events but they were not added because they must be for instance
if (CreatureEventAIList.empty())
sLog.outError("CreatureEventAI: Creature %u has events but no events added to list because of instance flags.", m_creature->GetEntry());
sLog.outError("CreatureEventAI: Creature %u has events but no events added to list because of instance flags.", me->GetEntry());
}
else
sLog.outError("CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", m_creature->GetEntry());
sLog.outError("CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", me->GetEntry());
bEmptyList = CreatureEventAIList.empty();
Phase = 0;
@@ -122,52 +122,52 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
switch (event.event_type)
{
case EVENT_T_TIMER:
if (!m_creature->isInCombat())
if (!me->isInCombat())
return false;
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.timer.repeatMin,event.timer.repeatMax);
pHolder.UpdateRepeatTimer(me,event.timer.repeatMin,event.timer.repeatMax);
break;
case EVENT_T_TIMER_OOC:
if (m_creature->isInCombat())
if (me->isInCombat())
return false;
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.timer.repeatMin,event.timer.repeatMax);
pHolder.UpdateRepeatTimer(me,event.timer.repeatMin,event.timer.repeatMax);
break;
case EVENT_T_HP:
{
if (!m_creature->isInCombat() || !m_creature->GetMaxHealth())
if (!me->isInCombat() || !me->GetMaxHealth())
return false;
uint32 perc = (m_creature->GetHealth()*100) / m_creature->GetMaxHealth();
uint32 perc = (me->GetHealth()*100) / me->GetMaxHealth();
if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin)
return false;
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.percent_range.repeatMin,event.percent_range.repeatMax);
pHolder.UpdateRepeatTimer(me,event.percent_range.repeatMin,event.percent_range.repeatMax);
break;
}
case EVENT_T_MANA:
{
if (!m_creature->isInCombat() || !m_creature->GetMaxPower(POWER_MANA))
if (!me->isInCombat() || !me->GetMaxPower(POWER_MANA))
return false;
uint32 perc = (m_creature->GetPower(POWER_MANA)*100) / m_creature->GetMaxPower(POWER_MANA);
uint32 perc = (me->GetPower(POWER_MANA)*100) / me->GetMaxPower(POWER_MANA);
if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin)
return false;
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.percent_range.repeatMin,event.percent_range.repeatMax);
pHolder.UpdateRepeatTimer(me,event.percent_range.repeatMin,event.percent_range.repeatMax);
break;
}
case EVENT_T_AGGRO:
break;
case EVENT_T_KILL:
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.kill.repeatMin,event.kill.repeatMax);
pHolder.UpdateRepeatTimer(me,event.kill.repeatMin,event.kill.repeatMax);
break;
case EVENT_T_DEATH:
case EVENT_T_EVADE:
@@ -176,43 +176,43 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
//Spell hit is special case, param1 and param2 handled within CreatureEventAI::SpellHit
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.spell_hit.repeatMin,event.spell_hit.repeatMax);
pHolder.UpdateRepeatTimer(me,event.spell_hit.repeatMin,event.spell_hit.repeatMax);
break;
case EVENT_T_RANGE:
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.range.repeatMin,event.range.repeatMax);
pHolder.UpdateRepeatTimer(me,event.range.repeatMin,event.range.repeatMax);
break;
case EVENT_T_OOC_LOS:
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.ooc_los.repeatMin,event.ooc_los.repeatMax);
pHolder.UpdateRepeatTimer(me,event.ooc_los.repeatMin,event.ooc_los.repeatMax);
break;
case EVENT_T_RESET:
case EVENT_T_SPAWNED:
break;
case EVENT_T_TARGET_HP:
{
if (!m_creature->isInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->GetMaxHealth())
if (!me->isInCombat() || !me->getVictim() || !me->getVictim()->GetMaxHealth())
return false;
uint32 perc = (m_creature->getVictim()->GetHealth()*100) / m_creature->getVictim()->GetMaxHealth();
uint32 perc = (me->getVictim()->GetHealth()*100) / me->getVictim()->GetMaxHealth();
if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin)
return false;
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.percent_range.repeatMin,event.percent_range.repeatMax);
pHolder.UpdateRepeatTimer(me,event.percent_range.repeatMin,event.percent_range.repeatMax);
break;
}
case EVENT_T_TARGET_CASTING:
if (!m_creature->isInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->IsNonMeleeSpellCasted(false, false, true))
if (!me->isInCombat() || !me->getVictim() || !me->getVictim()->IsNonMeleeSpellCasted(false, false, true))
return false;
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.target_casting.repeatMin,event.target_casting.repeatMax);
pHolder.UpdateRepeatTimer(me,event.target_casting.repeatMin,event.target_casting.repeatMax);
break;
case EVENT_T_FRIENDLY_HP:
{
if (!m_creature->isInCombat())
if (!me->isInCombat())
return false;
Unit* pUnit = DoSelectLowestHpFriendly(event.friendly_hp.radius, event.friendly_hp.hpDeficit);
@@ -222,12 +222,12 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
pActionInvoker = pUnit;
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.friendly_hp.repeatMin,event.friendly_hp.repeatMax);
pHolder.UpdateRepeatTimer(me,event.friendly_hp.repeatMin,event.friendly_hp.repeatMax);
break;
}
case EVENT_T_FRIENDLY_IS_CC:
{
if (!m_creature->isInCombat())
if (!me->isInCombat())
return false;
std::list<Creature*> pList;
@@ -241,7 +241,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
pActionInvoker = *(pList.begin());
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.friendly_is_cc.repeatMin,event.friendly_is_cc.repeatMax);
pHolder.UpdateRepeatTimer(me,event.friendly_is_cc.repeatMin,event.friendly_is_cc.repeatMax);
break;
}
case EVENT_T_FRIENDLY_MISSING_BUFF:
@@ -257,7 +257,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
pActionInvoker = *(pList.begin());
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.friendly_buff.repeatMin,event.friendly_buff.repeatMax);
pHolder.UpdateRepeatTimer(me,event.friendly_buff.repeatMin,event.friendly_buff.repeatMax);
break;
}
case EVENT_T_SUMMONED_UNIT:
@@ -271,21 +271,21 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
return false;
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.summon_unit.repeatMin,event.summon_unit.repeatMax);
pHolder.UpdateRepeatTimer(me,event.summon_unit.repeatMin,event.summon_unit.repeatMax);
break;
}
case EVENT_T_TARGET_MANA:
{
if (!m_creature->isInCombat() || !m_creature->getVictim() || !m_creature->getVictim()->GetMaxPower(POWER_MANA))
if (!me->isInCombat() || !me->getVictim() || !me->getVictim()->GetMaxPower(POWER_MANA))
return false;
uint32 perc = (m_creature->getVictim()->GetPower(POWER_MANA)*100) / m_creature->getVictim()->GetMaxPower(POWER_MANA);
uint32 perc = (me->getVictim()->GetPower(POWER_MANA)*100) / me->getVictim()->GetMaxPower(POWER_MANA);
if (perc > event.percent_range.percentMax || perc < event.percent_range.percentMin)
return false;
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.percent_range.repeatMin,event.percent_range.repeatMax);
pHolder.UpdateRepeatTimer(me,event.percent_range.repeatMin,event.percent_range.repeatMax);
break;
}
case EVENT_T_REACHED_HOME:
@@ -295,12 +295,12 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
{
//Note: checked only aura for effect 0, if need check aura for effect 1/2 then
// possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx)
Aura const * aura = m_creature->GetAura(event.buffed.spellId);
Aura const * aura = me->GetAura(event.buffed.spellId);
if (!aura || aura->GetStackAmount() < event.buffed.amount)
return false;
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.buffed.repeatMin,event.buffed.repeatMax);
pHolder.UpdateRepeatTimer(me,event.buffed.repeatMin,event.buffed.repeatMax);
break;
}
case EVENT_T_TARGET_BUFFED:
@@ -316,11 +316,11 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
return false;
//Repeat Timers
pHolder.UpdateRepeatTimer(m_creature,event.buffed.repeatMin,event.buffed.repeatMax);
pHolder.UpdateRepeatTimer(me,event.buffed.repeatMin,event.buffed.repeatMax);
break;
}
default:
sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", m_creature->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
sLog.outErrorDb("CreatureEventAI: Creature %u using Event %u has invalid Event Type(%u), missing from ProcessEvent() Switch.", me->GetEntry(), pHolder.Event.event_id, pHolder.Event.event_type);
break;
}
@@ -374,7 +374,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
target = owner;
}
}
else if ((target = m_creature->getVictim()))
else if ((target = me->getVictim()))
{
if (target->GetTypeId() != TYPEID_PLAYER)
if (Unit* owner = target->GetOwner())
@@ -382,21 +382,21 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
target = owner;
}
DoScriptText(temp, m_creature, target);
DoScriptText(temp, me, target);
}
break;
}
case ACTION_T_SET_FACTION:
{
if (action.set_faction.factionId)
m_creature->setFaction(action.set_faction.factionId);
me->setFaction(action.set_faction.factionId);
else
{
if (CreatureInfo const* ci = GetCreatureTemplateStore(m_creature->GetEntry()))
if (CreatureInfo const* ci = GetCreatureTemplateStore(me->GetEntry()))
{
//if no id provided, assume reset and then use default
if (m_creature->getFaction() != ci->faction_A)
m_creature->setFaction(ci->faction_A);
if (me->getFaction() != ci->faction_A)
me->setFaction(ci->faction_A);
}
}
break;
@@ -411,41 +411,41 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
if (CreatureInfo const* ci = GetCreatureTemplateStore(action.morph.creatureId))
{
uint32 display_id = objmgr.ChooseDisplayId(0,ci);
m_creature->SetDisplayId(display_id);
me->SetDisplayId(display_id);
}
}
//if no param1, then use value from param2 (modelId)
else
m_creature->SetDisplayId(action.morph.modelId);
me->SetDisplayId(action.morph.modelId);
}
else
m_creature->DeMorph();
me->DeMorph();
break;
}
case ACTION_T_SOUND:
m_creature->PlayDirectSound(action.sound.soundId);
me->PlayDirectSound(action.sound.soundId);
break;
case ACTION_T_EMOTE:
m_creature->HandleEmoteCommand(action.emote.emoteId);
me->HandleEmoteCommand(action.emote.emoteId);
break;
case ACTION_T_RANDOM_SOUND:
{
int32 temp = GetRandActionParam(rnd, action.random_sound.soundId1, action.random_sound.soundId2, action.random_sound.soundId3);
if (temp >= 0)
m_creature->PlayDirectSound(temp);
me->PlayDirectSound(temp);
break;
}
case ACTION_T_RANDOM_EMOTE:
{
int32 temp = GetRandActionParam(rnd, action.random_emote.emoteId1, action.random_emote.emoteId2, action.random_emote.emoteId3);
if (temp >= 0)
m_creature->HandleEmoteCommand(temp);
me->HandleEmoteCommand(temp);
break;
}
case ACTION_T_CAST:
{
Unit* target = GetTargetByType(action.cast.target, pActionInvoker);
Unit* caster = m_creature;
Unit* caster = me;
if (!target)
return;
@@ -477,12 +477,12 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
//Melee current victim if flag not set
if (!(action.cast.castFlags & CAST_NO_MELEE_IF_OOM))
{
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
{
AttackDistance = 0.0f;
AttackAngle = 0.0f;
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), AttackDistance, AttackAngle);
me->GetMotionMaster()->MoveChase(me->getVictim(), AttackDistance, AttackAngle);
}
}
@@ -498,7 +498,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
else
sLog.outErrorDb("CreatureEventAI: event %d creature %d attempt to cast spell that doesn't exist %d", EventId, m_creature->GetEntry(), action.cast.spellId);
sLog.outErrorDb("CreatureEventAI: event %d creature %d attempt to cast spell that doesn't exist %d", EventId, me->GetEntry(), action.cast.spellId);
}
break;
}
@@ -509,26 +509,26 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
Creature* pCreature = NULL;
if (action.summon.duration)
pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, action.summon.duration);
pCreature = me->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, action.summon.duration);
else
pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
pCreature = me->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
if (!pCreature)
sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, me->GetEntry());
else if (action.summon.target != TARGET_T_SELF && target)
pCreature->AI()->AttackStart(target);
break;
}
case ACTION_T_THREAT_SINGLE_PCT:
if (Unit* target = GetTargetByType(action.threat_single_pct.target, pActionInvoker))
m_creature->getThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent);
me->getThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent);
break;
case ACTION_T_THREAT_ALL_PCT:
{
std::list<HostileReference*>& threatList = m_creature->getThreatManager().getThreatList();
std::list<HostileReference*>& threatList = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
if (Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid()))
m_creature->getThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent);
if (Unit* Temp = Unit::GetUnit(*me,(*i)->getUnitGuid()))
me->getThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent);
break;
}
case ACTION_T_QUEST_EVENT:
@@ -539,7 +539,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
case ACTION_T_CAST_EVENT:
if (Unit* target = GetTargetByType(action.cast_event.target, pActionInvoker))
if (target->GetTypeId() == TYPEID_PLAYER)
target->ToPlayer()->CastedCreatureOrGO(action.cast_event.creatureId, m_creature->GetGUID(), action.cast_event.spellId);
target->ToPlayer()->CastedCreatureOrGO(action.cast_event.creatureId, me->GetGUID(), action.cast_event.spellId);
break;
case ACTION_T_SET_UNIT_FIELD:
{
@@ -575,30 +575,30 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
//Allow movement (create new targeted movement gen only if idle)
if (CombatMovementEnabled)
{
Unit* victim = m_creature->getVictim();
if (m_creature->isInCombat() && victim)
Unit* victim = me->getVictim();
if (me->isInCombat() && victim)
{
if (action.combat_movement.melee)
{
m_creature->addUnitState(UNIT_STAT_MELEE_ATTACKING);
m_creature->SendMeleeAttackStart(victim);
me->addUnitState(UNIT_STAT_MELEE_ATTACKING);
me->SendMeleeAttackStart(victim);
}
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE)
m_creature->GetMotionMaster()->MoveChase(victim, AttackDistance, AttackAngle); // Targeted movement generator will start melee automatically, no need to send it explicitly
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == IDLE_MOTION_TYPE)
me->GetMotionMaster()->MoveChase(victim, AttackDistance, AttackAngle); // Targeted movement generator will start melee automatically, no need to send it explicitly
}
}
else
{
if (m_creature->isInCombat())
if (me->isInCombat())
{
Unit* victim = m_creature->getVictim();
Unit* victim = me->getVictim();
if (action.combat_movement.melee && victim)
{
m_creature->clearUnitState(UNIT_STAT_MELEE_ATTACKING);
m_creature->SendMeleeAttackStop(victim);
me->clearUnitState(UNIT_STAT_MELEE_ATTACKING);
me->SendMeleeAttackStop(victim);
}
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
m_creature->GetMotionMaster()->MoveIdle();
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
me->GetMotionMaster()->MoveIdle();
}
}
break;
@@ -610,12 +610,12 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
int32 new_phase = int32(Phase)+action.set_inc_phase.step;
if (new_phase < 0)
{
sLog.outErrorDb("CreatureEventAI: Event %d decrease Phase under 0. CreatureEntry = %d", EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: Event %d decrease Phase under 0. CreatureEntry = %d", EventId, me->GetEntry());
Phase = 0;
}
else if (new_phase >= MAX_PHASE)
{
sLog.outErrorDb("CreatureEventAI: Event %d incremented Phase above %u. Phase mask cannot be used with phases past %u. CreatureEntry = %d", EventId, MAX_PHASE-1, MAX_PHASE-1, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: Event %d incremented Phase above %u. Phase mask cannot be used with phases past %u. CreatureEntry = %d", EventId, MAX_PHASE-1, MAX_PHASE-1, me->GetEntry());
Phase = MAX_PHASE-1;
}
else
@@ -627,23 +627,23 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
EnterEvadeMode();
break;
case ACTION_T_FLEE_FOR_ASSIST:
m_creature->DoFleeToGetAssistance();
me->DoFleeToGetAssistance();
break;
case ACTION_T_QUEST_EVENT_ALL:
if (pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER)
{
if (Unit* Temp = Unit::GetUnit(*m_creature,pActionInvoker->GetGUID()))
if (Unit* Temp = Unit::GetUnit(*me,pActionInvoker->GetGUID()))
if (Temp->GetTypeId() == TYPEID_PLAYER)
Temp->ToPlayer()->GroupEventHappens(action.quest_event_all.questId,m_creature);
Temp->ToPlayer()->GroupEventHappens(action.quest_event_all.questId,me);
}
break;
case ACTION_T_CAST_EVENT_ALL:
{
std::list<HostileReference*>& threatList = m_creature->getThreatManager().getThreatList();
std::list<HostileReference*>& threatList = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator i = threatList.begin(); i != threatList.end(); ++i)
if (Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid()))
if (Unit* Temp = Unit::GetUnit(*me,(*i)->getUnitGuid()))
if (Temp->GetTypeId() == TYPEID_PLAYER)
Temp->ToPlayer()->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetGUID(), action.cast_event_all.spellId);
Temp->ToPlayer()->CastedCreatureOrGO(action.cast_event_all.creatureId, me->GetGUID(), action.cast_event_all.spellId);
break;
}
case ACTION_T_REMOVEAURASFROMSPELL:
@@ -656,7 +656,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
if (CombatMovementEnabled)
{
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), AttackDistance, AttackAngle);
me->GetMotionMaster()->MoveChase(me->getVictim(), AttackDistance, AttackAngle);
}
break;
case ACTION_T_RANDOM_PHASE:
@@ -666,7 +666,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
if (action.random_phase_range.phaseMin <= action.random_phase_range.phaseMax)
Phase = urand(action.random_phase_range.phaseMin, action.random_phase_range.phaseMax);
else
sLog.outErrorDb("CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 < Param1. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: ACTION_T_RANDOM_PHASE_RANGE cannot have Param2 < Param1. Event = %d. CreatureEntry = %d", EventId, me->GetEntry());
break;
case ACTION_T_SUMMON_ID:
{
@@ -675,18 +675,18 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
CreatureEventAI_Summon_Map::const_iterator i = CreatureEAI_Mgr.GetCreatureEventAISummonMap().find(action.summon_id.spawnId);
if (i == CreatureEAI_Mgr.GetCreatureEventAISummonMap().end())
{
sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. Summon map index %u does not exist. EventID %d. CreatureID %d", action.summon_id.creatureId, action.summon_id.spawnId, EventId, me->GetEntry());
return;
}
Creature* pCreature = NULL;
if ((*i).second.SpawnTimeSecs)
pCreature = m_creature->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, (*i).second.SpawnTimeSecs);
pCreature = me->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, (*i).second.SpawnTimeSecs);
else
pCreature = m_creature->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
pCreature = me->SummonCreature(action.summon_id.creatureId, (*i).second.position_x, (*i).second.position_y, (*i).second.position_z, (*i).second.orientation, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0);
if (!pCreature)
sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, me->GetEntry());
else if (action.summon_id.target != TARGET_T_SELF && target)
pCreature->AI()->AttackStart(target);
@@ -694,22 +694,22 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
case ACTION_T_KILLED_MONSTER:
//first attempt player who tapped creature
if (Player* pPlayer = m_creature->GetLootRecipient())
pPlayer->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, m_creature);
if (Player* pPlayer = me->GetLootRecipient())
pPlayer->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, me);
else
{
//if not available, use pActionInvoker
if (Unit* pTarget = GetTargetByType(action.killed_monster.target, pActionInvoker))
if (Player* pPlayer2 = pTarget->GetCharmerOrOwnerPlayerOrPlayerItself())
pPlayer2->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, m_creature);
pPlayer2->RewardPlayerAndGroupAtEvent(action.killed_monster.creatureId, me);
}
break;
case ACTION_T_SET_INST_DATA:
{
InstanceData* pInst = (InstanceData*)m_creature->GetInstanceData();
InstanceData* pInst = (InstanceData*)me->GetInstanceData();
if (!pInst)
{
sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data without instance script. Creature %d", EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data without instance script. Creature %d", EventId, me->GetEntry());
return;
}
@@ -721,14 +721,14 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
Unit* target = GetTargetByType(action.set_inst_data64.target, pActionInvoker);
if (!target)
{
sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 but Target == NULL. Creature %d", EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 but Target == NULL. Creature %d", EventId, me->GetEntry());
return;
}
InstanceData* pInst = (InstanceData*)m_creature->GetInstanceData();
InstanceData* pInst = (InstanceData*)me->GetInstanceData();
if (!pInst)
{
sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 without instance script. Creature %d", EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: Event %d attempt to set instance data64 without instance script. Creature %d", EventId, me->GetEntry());
return;
}
@@ -736,32 +736,32 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
break;
}
case ACTION_T_UPDATE_TEMPLATE:
if (m_creature->GetEntry() == action.update_template.creatureId)
if (me->GetEntry() == action.update_template.creatureId)
{
sLog.outErrorDb("CreatureEventAI: Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: Event %d ACTION_T_UPDATE_TEMPLATE call with param1 == current entry. Creature %d", EventId, me->GetEntry());
return;
}
m_creature->UpdateEntry(action.update_template.creatureId, action.update_template.team ? HORDE : ALLIANCE);
me->UpdateEntry(action.update_template.creatureId, action.update_template.team ? HORDE : ALLIANCE);
break;
case ACTION_T_DIE:
if (m_creature->isDead())
if (me->isDead())
{
sLog.outErrorDb("CreatureEventAI: Event %d ACTION_T_DIE on dead creature. Creature %d", EventId, m_creature->GetEntry());
sLog.outErrorDb("CreatureEventAI: Event %d ACTION_T_DIE on dead creature. Creature %d", EventId, me->GetEntry());
return;
}
m_creature->Kill(m_creature);
me->Kill(me);
break;
case ACTION_T_ZONE_COMBAT_PULSE:
{
m_creature->SetInCombatWithZone();
me->SetInCombatWithZone();
break;
}
case ACTION_T_CALL_FOR_HELP:
{
m_creature->CallForHelp(action.call_for_help.radius);
me->CallForHelp(action.call_for_help.radius);
break;
}
break;
@@ -797,29 +797,29 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
GameObject* pObject = NULL;
float x,y,z;
m_creature->GetPosition(x,y,z);
pObject = m_creature->SummonGameObject(action.raw.param1, x, y, z, 0, 0, 0, 0, 0, action.raw.param2);
me->GetPosition(x,y,z);
pObject = me->SummonGameObject(action.raw.param1, x, y, z, 0, 0, 0, 0, 0, action.raw.param2);
if (!pObject)
{
sLog.outErrorDb("TSCR: EventAI failed to spawn object %u. Spawn event %d is on creature %d", action.raw.param1, EventId, m_creature->GetEntry());
sLog.outErrorDb("TSCR: EventAI failed to spawn object %u. Spawn event %d is on creature %d", action.raw.param1, EventId, me->GetEntry());
}
break;
}
case ACTION_T_SET_SHEATH:
{
m_creature->SetSheath(SheathState(action.set_sheath.sheath));
me->SetSheath(SheathState(action.set_sheath.sheath));
break;
}
case ACTION_T_FORCE_DESPAWN:
{
m_creature->ForcedDespawn(action.forced_despawn.msDelay);
me->ForcedDespawn(action.forced_despawn.msDelay);
break;
}
case ACTION_T_SET_INVINCIBILITY_HP_LEVEL:
{
if (action.invincibility_hp_level.is_percent)
InvinceabilityHpLevel = m_creature->GetMaxHealth()*action.invincibility_hp_level.hp_level/100;
InvinceabilityHpLevel = me->GetMaxHealth()*action.invincibility_hp_level.hp_level/100;
else
InvinceabilityHpLevel = action.invincibility_hp_level.hp_level;
break;
@@ -865,7 +865,7 @@ void CreatureEventAI::Reset()
//Reset all out of combat timers
case EVENT_T_TIMER_OOC:
{
if ((*i).UpdateRepeatTimer(m_creature,event.timer.initialMin,event.timer.initialMax))
if ((*i).UpdateRepeatTimer(me,event.timer.initialMin,event.timer.initialMax))
(*i).Enabled = true;
break;
}
@@ -880,7 +880,7 @@ void CreatureEventAI::Reset()
void CreatureEventAI::JustReachedHome()
{
m_creature->LoadCreaturesAddon();
me->LoadCreaturesAddon();
if (!bEmptyList)
{
@@ -967,7 +967,7 @@ void CreatureEventAI::EnterCombat(Unit *enemy)
break;
//Reset all in combat timers
case EVENT_T_TIMER:
if ((*i).UpdateRepeatTimer(m_creature,event.timer.initialMin,event.timer.initialMax))
if ((*i).UpdateRepeatTimer(me,event.timer.initialMin,event.timer.initialMax))
(*i).Enabled = true;
break;
//All normal events need to be re-enabled and their time set to 0
@@ -988,15 +988,15 @@ void CreatureEventAI::AttackStart(Unit *who)
if (!who)
return;
if (m_creature->Attack(who, MeleeEnabled))
if (me->Attack(who, MeleeEnabled))
{
if (CombatMovementEnabled)
{
m_creature->GetMotionMaster()->MoveChase(who, AttackDistance, AttackAngle);
me->GetMotionMaster()->MoveChase(who, AttackDistance, AttackAngle);
}
else
{
m_creature->GetMotionMaster()->MoveIdle();
me->GetMotionMaster()->MoveIdle();
}
}
}
@@ -1017,11 +1017,11 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who)
float fMaxAllowedRange = (*itr).Event.ooc_los.maxRange;
//if range is ok and we are actually in LOS
if (m_creature->IsWithinDistInMap(who, fMaxAllowedRange) && m_creature->IsWithinLOSInMap(who))
if (me->IsWithinDistInMap(who, fMaxAllowedRange) && me->IsWithinLOSInMap(who))
{
//if friendly event&&who is not hostile OR hostile event&&who is hostile
if (((*itr).Event.ooc_los.noHostile && !m_creature->IsHostileTo(who)) ||
((!(*itr).Event.ooc_los.noHostile) && m_creature->IsHostileTo(who)))
if (((*itr).Event.ooc_los.noHostile && !me->IsHostileTo(who)) ||
((!(*itr).Event.ooc_los.noHostile) && me->IsHostileTo(who)))
ProcessEvent(*itr, who);
}
}
@@ -1092,8 +1092,8 @@ void CreatureEventAI::UpdateAI(const uint32 diff)
break;
case EVENT_T_RANGE:
if (me->getVictim())
if (m_creature->IsInMap(m_creature->getVictim()))
if (m_creature->IsInRange(m_creature->getVictim(),(float)(*i).Event.range.minDist,(float)(*i).Event.range.maxDist))
if (me->IsInMap(me->getVictim()))
if (me->IsInRange(me->getVictim(),(float)(*i).Event.range.minDist,(float)(*i).Event.range.maxDist))
ProcessEvent(*i);
break;
}
@@ -1141,9 +1141,9 @@ inline Unit* CreatureEventAI::GetTargetByType(uint32 Target, Unit* pActionInvoke
switch (Target)
{
case TARGET_T_SELF:
return m_creature;
return me;
case TARGET_T_HOSTILE:
return m_creature->getVictim();
return me->getVictim();
case TARGET_T_HOSTILE_SECOND_AGGRO:
return SelectTarget(SELECT_TARGET_TOPAGGRO,1);
case TARGET_T_HOSTILE_LAST_AGGRO:
@@ -1161,15 +1161,15 @@ inline Unit* CreatureEventAI::GetTargetByType(uint32 Target, Unit* pActionInvoke
Unit* CreatureEventAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
{
CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY()));
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
Unit* pUnit = NULL;
Trinity::MostHPMissingInRange u_check(m_creature, range, MinHPDiff);
Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(m_creature, pUnit, u_check);
Trinity::MostHPMissingInRange u_check(me, range, MinHPDiff);
Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(me, pUnit, u_check);
/*
typedef TYPELIST_4(GameObject, Creature*except pets*, DynamicObject, Corpse*Bones*) AllGridObjectTypes;
@@ -1177,38 +1177,38 @@ Unit* CreatureEventAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
*/
TypeContainerVisitor<Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange>, GridTypeMapContainer > grid_unit_searcher(searcher);
cell.Visit(p, grid_unit_searcher, *m_creature->GetMap(), *m_creature, range);
cell.Visit(p, grid_unit_searcher, *me->GetMap(), *me, range);
return pUnit;
}
void CreatureEventAI::DoFindFriendlyCC(std::list<Creature*>& _list, float range)
{
CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY()));
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
Trinity::FriendlyCCedInRange u_check(m_creature, range);
Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange> searcher(m_creature, _list, u_check);
Trinity::FriendlyCCedInRange u_check(me, range);
Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange> searcher(me, _list, u_check);
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange>, GridTypeMapContainer > grid_creature_searcher(searcher);
cell.Visit(p, grid_creature_searcher, *m_creature->GetMap());
cell.Visit(p, grid_creature_searcher, *me->GetMap());
}
void CreatureEventAI::DoFindFriendlyMissingBuff(std::list<Creature*>& _list, float range, uint32 spellid)
{
CellPair p(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
CellPair p(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY()));
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
Trinity::FriendlyMissingBuffInRange u_check(m_creature, range, spellid);
Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange> searcher(m_creature, _list, u_check);
Trinity::FriendlyMissingBuffInRange u_check(me, range, spellid);
Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange> searcher(me, _list, u_check);
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange>, GridTypeMapContainer > grid_creature_searcher(searcher);
cell.Visit(p, grid_creature_searcher, *m_creature->GetMap());
cell.Visit(p, grid_creature_searcher, *me->GetMap());
}
//*********************************
@@ -1311,7 +1311,7 @@ bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Trigge
return false;
//Unit is out of range of this spell
if (!m_creature->IsInRange(Target,TempRange->minRangeHostile,TempRange->maxRangeHostile))
if (!me->IsInRange(Target,TempRange->minRangeHostile,TempRange->maxRangeHostile))
return false;
return true;
@@ -1341,12 +1341,12 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
void CreatureEventAI::DamageTaken(Unit* done_by, uint32& damage)
{
if (InvinceabilityHpLevel > 0 && m_creature->GetHealth() < InvinceabilityHpLevel+damage)
if (InvinceabilityHpLevel > 0 && me->GetHealth() < InvinceabilityHpLevel+damage)
{
if (m_creature->GetHealth() <= InvinceabilityHpLevel)
if (me->GetHealth() <= InvinceabilityHpLevel)
damage = 0;
else
damage = m_creature->GetHealth() - InvinceabilityHpLevel;
damage = me->GetHealth() - InvinceabilityHpLevel;
}
}
@@ -1362,12 +1362,12 @@ bool CreatureEventAI::SpawnedEventConditionsCheck(CreatureEventAI_Event const& e
return true;
case SPAWNED_EVENT_MAP:
// map ID check
return m_creature->GetMapId() == event.spawned.conditionValue1;
return me->GetMapId() == event.spawned.conditionValue1;
case SPAWNED_EVENT_ZONE:
{
// zone ID check
uint32 zone, area;
m_creature->GetZoneAndAreaId(zone,area);
me->GetZoneAndAreaId(zone,area);
return zone == event.spawned.conditionValue1 || area == event.spawned.conditionValue1;
}
default:
+1 -1
View File
@@ -123,7 +123,7 @@ enum EventAI_ActionType
enum Target
{
//Self (m_creature)
//Self (me)
TARGET_T_SELF = 0, //Self cast
//Hostile targets (if pet then returns pet owner)
+6 -6
View File
@@ -943,7 +943,7 @@ namespace Trinity
class NearestHostileUnitInAttackDistanceCheck
{
public:
explicit NearestHostileUnitInAttackDistanceCheck(Creature const* creature, float dist = 0) : m_creature(creature)
explicit NearestHostileUnitInAttackDistanceCheck(Creature const* creature, float dist = 0) : me(creature)
{
m_range = (dist == 0 ? 9999 : dist);
m_force = (dist == 0 ? false : true);
@@ -951,26 +951,26 @@ namespace Trinity
bool operator()(Unit* u)
{
// TODO: addthreat for every enemy in range?
if (!m_creature->IsWithinDistInMap(u, m_range))
if (!me->IsWithinDistInMap(u, m_range))
return false;
if (m_force)
{
if (!m_creature->canAttack(u))
if (!me->canAttack(u))
return false;
}
else
{
if (!m_creature->canStartAttack(u, false))
if (!me->canStartAttack(u, false))
return false;
}
m_range = m_creature->GetDistance(u);
m_range = me->GetDistance(u);
return true;
}
float GetLastRange() const { return m_range; }
private:
Creature const *m_creature;
Creature const *me;
float m_range;
bool m_force;
NearestHostileUnitInAttackDistanceCheck(NearestHostileUnitInAttackDistanceCheck const&);
+31 -31
View File
@@ -40,15 +40,15 @@ GuardAI::GuardAI(Creature *c) : CreatureAI(c), i_victimGuid(0), i_state(STATE_NO
void GuardAI::MoveInLineOfSight(Unit *u)
{
// Ignore Z for flying creatures
if (!m_creature->canFly() && m_creature->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE)
if (!me->canFly() && me->GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE)
return;
if (!m_creature->getVictim() && m_creature->canAttack(u) &&
(u->IsHostileToPlayers() || m_creature->IsHostileTo(u) /*|| u->getVictim() && m_creature->IsFriendlyTo(u->getVictim())*/) &&
u->isInAccessiblePlaceFor(m_creature))
if (!me->getVictim() && me->canAttack(u) &&
(u->IsHostileToPlayers() || me->IsHostileTo(u) /*|| u->getVictim() && me->IsFriendlyTo(u->getVictim())*/) &&
u->isInAccessiblePlaceFor(me))
{
float attackRadius = m_creature->GetAttackDistance(u);
if (m_creature->IsWithinDistInMap(u,attackRadius))
float attackRadius = me->GetAttackDistance(u);
if (me->IsWithinDistInMap(u,attackRadius))
{
//Need add code to let guard support player
AttackStart(u);
@@ -59,80 +59,80 @@ void GuardAI::MoveInLineOfSight(Unit *u)
void GuardAI::EnterEvadeMode()
{
if (!m_creature->isAlive())
if (!me->isAlive())
{
DEBUG_LOG("Creature stopped attacking because he's dead [guid=%u]", m_creature->GetGUIDLow());
m_creature->GetMotionMaster()->MoveIdle();
DEBUG_LOG("Creature stopped attacking because he's dead [guid=%u]", me->GetGUIDLow());
me->GetMotionMaster()->MoveIdle();
i_state = STATE_NORMAL;
i_victimGuid = 0;
m_creature->CombatStop(true);
m_creature->DeleteThreatList();
me->CombatStop(true);
me->DeleteThreatList();
return;
}
Unit* victim = ObjectAccessor::GetUnit(*m_creature, i_victimGuid);
Unit* victim = ObjectAccessor::GetUnit(*me, i_victimGuid);
if (!victim)
{
DEBUG_LOG("Creature stopped attacking because victim is non exist [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking because victim is non exist [guid=%u]", me->GetGUIDLow());
}
else if (!victim ->isAlive())
{
DEBUG_LOG("Creature stopped attacking because victim is dead [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking because victim is dead [guid=%u]", me->GetGUIDLow());
}
else if (victim ->HasStealthAura())
{
DEBUG_LOG("Creature stopped attacking because victim is using stealth [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking because victim is using stealth [guid=%u]", me->GetGUIDLow());
}
else if (victim ->isInFlight())
{
DEBUG_LOG("Creature stopped attacking because victim is flying away [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking because victim is flying away [guid=%u]", me->GetGUIDLow());
}
else
{
DEBUG_LOG("Creature stopped attacking because victim outran him [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Creature stopped attacking because victim outran him [guid=%u]", me->GetGUIDLow());
}
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
me->RemoveAllAuras();
me->DeleteThreatList();
i_victimGuid = 0;
m_creature->CombatStop(true);
me->CombatStop(true);
i_state = STATE_NORMAL;
// Remove TargetedMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
m_creature->GetMotionMaster()->MoveTargetedHome();
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
me->GetMotionMaster()->MoveTargetedHome();
}
void GuardAI::UpdateAI(const uint32 /*diff*/)
{
// update i_victimGuid if m_creature->getVictim() !=0 and changed
// update i_victimGuid if me->getVictim() !=0 and changed
if (!UpdateVictim())
return;
i_victimGuid = m_creature->getVictim()->GetGUID();
i_victimGuid = me->getVictim()->GetGUID();
if (m_creature->isAttackReady())
if (me->isAttackReady())
{
if (m_creature->IsWithinMeleeRange(m_creature->getVictim()))
if (me->IsWithinMeleeRange(me->getVictim()))
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
me->AttackerStateUpdate(me->getVictim());
me->resetAttackTimer();
}
}
}
bool GuardAI::IsVisible(Unit *pl) const
{
return m_creature->IsWithinDist(pl,sWorld.getConfig(CONFIG_SIGHT_GUARDER))
&& pl->isVisibleForOrDetect(m_creature,true);
return me->IsWithinDist(pl,sWorld.getConfig(CONFIG_SIGHT_GUARDER))
&& pl->isVisibleForOrDetect(me,true);
}
void GuardAI::JustDied(Unit *killer)
{
if (Player* pkiller = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
m_creature->SendZoneUnderAttackMessage(pkiller);
me->SendZoneUnderAttackMessage(pkiller);
}
+30 -30
View File
@@ -51,36 +51,36 @@ void PetAI::EnterEvadeMode()
bool PetAI::_needToStop() const
{
// This is needed for charmed creatures, as once their target was reset other effects can trigger threat
if (m_creature->isCharmed() && m_creature->getVictim() == m_creature->GetCharmer())
if (me->isCharmed() && me->getVictim() == me->GetCharmer())
return true;
return !m_creature->canAttack(m_creature->getVictim());
return !me->canAttack(me->getVictim());
}
void PetAI::_stopAttack()
{
if (!m_creature->isAlive())
if (!me->isAlive())
{
DEBUG_LOG("Creature stoped attacking cuz his dead [guid=%u]", m_creature->GetGUIDLow());
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
m_creature->CombatStop();
m_creature->getHostileRefManager().deleteReferences();
DEBUG_LOG("Creature stoped attacking cuz his dead [guid=%u]", me->GetGUIDLow());
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
me->CombatStop();
me->getHostileRefManager().deleteReferences();
return;
}
m_creature->AttackStop();
me->AttackStop();
me->GetCharmInfo()->SetIsCommandAttack(false);
HandleReturnMovement();
}
void PetAI::UpdateAI(const uint32 diff)
{
if (!m_creature->isAlive())
if (!me->isAlive())
return;
Unit* owner = m_creature->GetCharmerOrOwner();
Unit* owner = me->GetCharmerOrOwner();
if (m_updateAlliesTimer <= diff)
// UpdateAllies self set update timer
@@ -88,19 +88,19 @@ void PetAI::UpdateAI(const uint32 diff)
else
m_updateAlliesTimer -= diff;
// m_creature->getVictim() can't be used for check in case stop fighting, m_creature->getVictim() clear at Unit death etc.
if (m_creature->getVictim())
// me->getVictim() can't be used for check in case stop fighting, me->getVictim() clear at Unit death etc.
if (me->getVictim())
{
if (_needToStop())
{
DEBUG_LOG("Pet AI stoped attacking [guid=%u]", m_creature->GetGUIDLow());
DEBUG_LOG("Pet AI stoped attacking [guid=%u]", me->GetGUIDLow());
_stopAttack();
return;
}
DoMeleeAttackIfReady();
}
else if (owner && m_creature->GetCharmInfo()) //no victim
else if (owner && me->GetCharmInfo()) //no victim
{
Unit *nextTarget = SelectNextTarget();
@@ -109,21 +109,21 @@ void PetAI::UpdateAI(const uint32 diff)
else
HandleReturnMovement();
}
else if (owner && !m_creature->hasUnitState(UNIT_STAT_FOLLOW)) // no charm info and no victim
m_creature->GetMotionMaster()->MoveFollow(owner,PET_FOLLOW_DIST, m_creature->GetFollowAngle());
else if (owner && !me->hasUnitState(UNIT_STAT_FOLLOW)) // no charm info and no victim
me->GetMotionMaster()->MoveFollow(owner,PET_FOLLOW_DIST, me->GetFollowAngle());
if (!me->GetCharmInfo())
return;
// Autocast (casted only in combat or persistent spells in any state)
if (m_creature->GetGlobalCooldown() == 0 && !m_creature->hasUnitState(UNIT_STAT_CASTING))
if (me->GetGlobalCooldown() == 0 && !me->hasUnitState(UNIT_STAT_CASTING))
{
typedef std::vector<std::pair<Unit*, Spell*> > TargetSpellList;
TargetSpellList targetSpellStore;
for (uint8 i = 0; i < m_creature->GetPetAutoSpellSize(); ++i)
for (uint8 i = 0; i < me->GetPetAutoSpellSize(); ++i)
{
uint32 spellID = m_creature->GetPetAutoSpellOnPos(i);
uint32 spellID = me->GetPetAutoSpellOnPos(i);
if (!spellID)
continue;
@@ -161,12 +161,12 @@ void PetAI::UpdateAI(const uint32 diff)
continue;
}
Spell *spell = new Spell(m_creature, spellInfo, false, 0);
Spell *spell = new Spell(me, spellInfo, false, 0);
// Fix to allow pets on STAY to autocast
if (me->getVictim() && _CanAttack(me->getVictim()) && spell->CanAutoCast(me->getVictim()))
{
targetSpellStore.push_back(std::make_pair<Unit*, Spell*>(m_creature->getVictim(), spell));
targetSpellStore.push_back(std::make_pair<Unit*, Spell*>(me->getVictim(), spell));
continue;
}
else
@@ -174,7 +174,7 @@ void PetAI::UpdateAI(const uint32 diff)
bool spellUsed = false;
for (std::set<uint64>::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar)
{
Unit* Target = ObjectAccessor::GetUnit(*m_creature,*tar);
Unit* Target = ObjectAccessor::GetUnit(*me,*tar);
//only buff targets that are in combat, unless the spell can only be cast while out of combat
if (!Target)
@@ -205,17 +205,17 @@ void PetAI::UpdateAI(const uint32 diff)
SpellCastTargets targets;
targets.setUnitTarget(target);
if (!m_creature->HasInArc(M_PI, target))
if (!me->HasInArc(M_PI, target))
{
m_creature->SetInFront(target);
me->SetInFront(target);
if (target && target->GetTypeId() == TYPEID_PLAYER)
m_creature->SendUpdateToPlayer(target->ToPlayer());
me->SendUpdateToPlayer(target->ToPlayer());
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
m_creature->SendUpdateToPlayer(owner->ToPlayer());
me->SendUpdateToPlayer(owner->ToPlayer());
}
m_creature->AddCreatureSpellCooldown(spell->m_spellInfo->Id);
me->AddCreatureSpellCooldown(spell->m_spellInfo->Id);
spell->prepare(&targets);
}
@@ -228,7 +228,7 @@ void PetAI::UpdateAI(const uint32 diff)
void PetAI::UpdateAllies()
{
Unit* owner = m_creature->GetCharmerOrOwner();
Unit* owner = me->GetCharmerOrOwner();
Group *pGroup = NULL;
m_updateAlliesTimer = 10*IN_MILISECONDS; //update friendly targets every 10 seconds, lesser checks increase performance
@@ -246,7 +246,7 @@ void PetAI::UpdateAllies()
return;
m_AllySet.clear();
m_AllySet.insert(m_creature->GetGUID());
m_AllySet.insert(me->GetGUID());
if (pGroup) //add group
{
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
+5 -5
View File
@@ -44,16 +44,16 @@ ReactorAI::MoveInLineOfSight(Unit *)
void
ReactorAI::UpdateAI(const uint32 /*time_diff*/)
{
// update i_victimGuid if m_creature->getVictim() !=0 and changed
// update i_victimGuid if me->getVictim() !=0 and changed
if (!UpdateVictim())
return;
if (m_creature->isAttackReady())
if (me->isAttackReady())
{
if (m_creature->IsWithinMeleeRange(m_creature->getVictim()))
if (me->IsWithinMeleeRange(me->getVictim()))
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
me->AttackerStateUpdate(me->getVictim());
me->resetAttackTimer();
}
}
}
+70 -70
View File
@@ -22,7 +22,7 @@ void SummonList::DoZoneInCombat(uint32 entry)
{
for (iterator i = begin(); i != end();)
{
Creature *summon = Unit::GetCreature(*m_creature, *i);
Creature *summon = Unit::GetCreature(*me, *i);
++i;
if (summon && summon->IsAIEnabled
&& (!entry || summon->GetEntry() == entry))
@@ -34,7 +34,7 @@ void SummonList::DoAction(uint32 entry, uint32 info)
{
for (iterator i = begin(); i != end();)
{
Creature *summon = Unit::GetCreature(*m_creature, *i);
Creature *summon = Unit::GetCreature(*me, *i);
++i;
if (summon && summon->IsAIEnabled
&& (!entry || summon->GetEntry() == entry))
@@ -46,7 +46,7 @@ void SummonList::DespawnEntry(uint32 entry)
{
for (iterator i = begin(); i != end();)
{
Creature *summon = Unit::GetCreature(*m_creature, *i);
Creature *summon = Unit::GetCreature(*me, *i);
if (!summon)
erase(i++);
else if (summon->GetEntry() == entry)
@@ -64,7 +64,7 @@ void SummonList::DespawnAll()
{
while (!empty())
{
Creature *summon = Unit::GetCreature(*m_creature, *begin());
Creature *summon = Unit::GetCreature(*me, *begin());
if (!summon)
erase(begin());
else
@@ -82,13 +82,13 @@ void SummonList::DespawnAll()
}
ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature),
m_creature(pCreature),
me(pCreature),
IsFleeing(false),
m_bCombatMovement(true),
m_uiEvadeCheckCooldown(2500)
{
m_heroicMode = m_creature->GetMap()->IsHeroic();
m_difficulty = Difficulty(m_creature->GetMap()->GetSpawnMode());
m_heroicMode = me->GetMap()->IsHeroic();
m_difficulty = Difficulty(me->GetMap()->GetSpawnMode());
}
void ScriptedAI::AttackStartNoMove(Unit* pWho)
@@ -96,7 +96,7 @@ void ScriptedAI::AttackStartNoMove(Unit* pWho)
if (!pWho)
return;
if (m_creature->Attack(pWho, false))
if (me->Attack(pWho, false))
DoStartNoMovement(pWho);
}
@@ -106,13 +106,13 @@ void ScriptedAI::UpdateAI(const uint32 uiDiff)
if (!UpdateVictim())
return;
if (m_creature->isAttackReady())
if (me->isAttackReady())
{
//If we are within range melee the target
if (m_creature->IsWithinMeleeRange(m_creature->getVictim()))
if (me->IsWithinMeleeRange(me->getVictim()))
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
me->AttackerStateUpdate(me->getVictim());
me->resetAttackTimer();
}
}
}
@@ -120,7 +120,7 @@ void ScriptedAI::UpdateAI(const uint32 uiDiff)
void ScriptedAI::DoStartMovement(Unit* pVictim, float fDistance, float fAngle)
{
if (pVictim)
m_creature->GetMotionMaster()->MoveChase(pVictim, fDistance, fAngle);
me->GetMotionMaster()->MoveChase(pVictim, fDistance, fAngle);
}
void ScriptedAI::DoStartNoMovement(Unit* pVictim)
@@ -128,22 +128,22 @@ void ScriptedAI::DoStartNoMovement(Unit* pVictim)
if (!pVictim)
return;
m_creature->GetMotionMaster()->MoveIdle();
me->GetMotionMaster()->MoveIdle();
}
void ScriptedAI::DoStopAttack()
{
if (m_creature->getVictim())
m_creature->AttackStop();
if (me->getVictim())
me->AttackStop();
}
void ScriptedAI::DoCastSpell(Unit* pTarget, SpellEntry const* pSpellInfo, bool bTriggered)
{
if (!pTarget || m_creature->IsNonMeleeSpellCasted(false))
if (!pTarget || me->IsNonMeleeSpellCasted(false))
return;
m_creature->StopMoving();
m_creature->CastSpell(pTarget, pSpellInfo, bTriggered);
me->StopMoving();
me->CastSpell(pTarget, pSpellInfo, bTriggered);
}
void ScriptedAI::DoPlaySoundToSet(WorldObject* pSource, uint32 uiSoundId)
@@ -162,13 +162,13 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* pSource, uint32 uiSoundId)
Creature* ScriptedAI::DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ, float fAngle, uint32 uiType, uint32 uiDespawntime)
{
return m_creature->SummonCreature(uiId, m_creature->GetPositionX()+fX, m_creature->GetPositionY()+fY, m_creature->GetPositionZ()+fZ, fAngle, (TempSummonType)uiType, uiDespawntime);
return me->SummonCreature(uiId, me->GetPositionX()+fX, me->GetPositionY()+fY, me->GetPositionZ()+fZ, fAngle, (TempSummonType)uiType, uiDespawntime);
}
Unit* ScriptedAI::SelectUnit(SelectAggroTarget pTarget, uint32 uiPosition)
{
//ThreatList m_threatlist;
std::list<HostileReference*>& threatlist = m_creature->getThreatManager().getThreatList();
std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList();
std::list<HostileReference*>::iterator itr = threatlist.begin();
std::list<HostileReference*>::reverse_iterator ritr = threatlist.rbegin();
@@ -179,17 +179,17 @@ Unit* ScriptedAI::SelectUnit(SelectAggroTarget pTarget, uint32 uiPosition)
{
case SELECT_TARGET_RANDOM:
advance (itr , uiPosition + (rand() % (threatlist.size() - uiPosition)));
return Unit::GetUnit((*m_creature),(*itr)->getUnitGuid());
return Unit::GetUnit((*me),(*itr)->getUnitGuid());
break;
case SELECT_TARGET_TOPAGGRO:
advance (itr , uiPosition);
return Unit::GetUnit((*m_creature),(*itr)->getUnitGuid());
return Unit::GetUnit((*me),(*itr)->getUnitGuid());
break;
case SELECT_TARGET_BOTTOMAGGRO:
advance (ritr , uiPosition);
return Unit::GetUnit((*m_creature),(*ritr)->getUnitGuid());
return Unit::GetUnit((*me),(*ritr)->getUnitGuid());
break;
default:
@@ -206,7 +206,7 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 u
return false;
//Silenced so we can't cast
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
return false;
//Using the extended script system we first create a list of viable spells
@@ -221,7 +221,7 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 u
//Check if each spell is viable(set it to null if not)
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; i++)
{
pTempSpell = GetSpellStore()->LookupEntry(m_creature->m_spells[i]);
pTempSpell = GetSpellStore()->LookupEntry(me->m_spells[i]);
//This spell doesn't exist
if (!pTempSpell)
@@ -229,11 +229,11 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 u
// Targets and Effects checked first as most used restrictions
//Check the spell targets if specified
if (selectTargets && !(SpellSummary[m_creature->m_spells[i]].Targets & (1 << (selectTargets-1))))
if (selectTargets && !(SpellSummary[me->m_spells[i]].Targets & (1 << (selectTargets-1))))
continue;
//Check the type of spell if we are looking for a specific spell type
if (selectEffects && !(SpellSummary[m_creature->m_spells[i]].Effects & (1 << (selectEffects-1))))
if (selectEffects && !(SpellSummary[me->m_spells[i]].Effects & (1 << (selectEffects-1))))
continue;
//Check for school if specified
@@ -252,7 +252,7 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 u
continue;
//Continue if we don't have the mana to actually cast this spell
if (pTempSpell->manaCost > m_creature->GetPower((Powers)pTempSpell->powerType))
if (pTempSpell->manaCost > me->GetPower((Powers)pTempSpell->powerType))
continue;
//Get the Range
@@ -263,13 +263,13 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 u
continue;
//Check if the spell meets our range requirements
if (fRangeMin && m_creature->GetSpellMinRangeForTarget(pTarget, pTempRange) < fRangeMin)
if (fRangeMin && me->GetSpellMinRangeForTarget(pTarget, pTempRange) < fRangeMin)
continue;
if (fRangeMax && m_creature->GetSpellMaxRangeForTarget(pTarget, pTempRange) > fRangeMax)
if (fRangeMax && me->GetSpellMaxRangeForTarget(pTarget, pTempRange) > fRangeMax)
continue;
//Check if our target is in range
if (m_creature->IsWithinDistInMap(pTarget, m_creature->GetSpellMinRangeForTarget(pTarget, pTempRange)) || !m_creature->IsWithinDistInMap(pTarget, m_creature->GetSpellMaxRangeForTarget(pTarget, pTempRange)))
if (me->IsWithinDistInMap(pTarget, me->GetSpellMinRangeForTarget(pTarget, pTempRange)) || !me->IsWithinDistInMap(pTarget, me->GetSpellMaxRangeForTarget(pTarget, pTempRange)))
continue;
//All good so lets add it to the spell list
@@ -305,7 +305,7 @@ bool ScriptedAI::CanCast(Unit* pTarget, SpellEntry const* pSpell, bool bTriggere
return false;
//Unit is out of range of this spell
if (me->IsInRange(pTarget, m_creature->GetSpellMinRangeForTarget(pTarget, pTempRange), m_creature->GetSpellMaxRangeForTarget(pTarget, pTempRange)))
if (me->IsInRange(pTarget, me->GetSpellMinRangeForTarget(pTarget, pTempRange), me->GetSpellMaxRangeForTarget(pTarget, pTempRange)))
return false;
return true;
@@ -398,17 +398,17 @@ void FillSpellSummary()
void ScriptedAI::DoResetThreat()
{
if (!m_creature->CanHaveThreatList() || m_creature->getThreatManager().isThreatListEmpty())
if (!me->CanHaveThreatList() || me->getThreatManager().isThreatListEmpty())
{
error_log("TSCR: DoResetThreat called for creature that either cannot have threat list or has empty threat list (m_creature entry = %d)", m_creature->GetEntry());
error_log("TSCR: DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry());
return;
}
std::list<HostileReference*>& threatlist = m_creature->getThreatManager().getThreatList();
std::list<HostileReference*>& threatlist = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && DoGetThreat(pUnit))
DoModifyThreatPercent(pUnit, -100);
@@ -418,19 +418,19 @@ void ScriptedAI::DoResetThreat()
float ScriptedAI::DoGetThreat(Unit* pUnit)
{
if (!pUnit) return 0.0f;
return m_creature->getThreatManager().getThreat(pUnit);
return me->getThreatManager().getThreat(pUnit);
}
void ScriptedAI::DoModifyThreatPercent(Unit* pUnit, int32 pct)
{
if (!pUnit) return;
m_creature->getThreatManager().modifyThreatPercent(pUnit, pct);
me->getThreatManager().modifyThreatPercent(pUnit, pct);
}
void ScriptedAI::DoTeleportTo(float fX, float fY, float fZ, uint32 uiTime)
{
m_creature->Relocate(fX, fY, fZ);
m_creature->SendMonsterMove(fX, fY, fZ, uiTime);
me->Relocate(fX, fY, fZ);
me->SendMonsterMove(fX, fY, fZ, uiTime);
}
void ScriptedAI::DoTeleportTo(const float fPos[4])
@@ -443,7 +443,7 @@ void ScriptedAI::DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, flo
if (!pUnit || pUnit->GetTypeId() != TYPEID_PLAYER)
{
if (pUnit)
error_log("TSCR: Creature %u (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: %u) to x: %f y:%f z: %f o: %f. Aborted.", m_creature->GetGUID(), m_creature->GetEntry(), pUnit->GetTypeId(), pUnit->GetGUID(), fX, fY, fZ, fO);
error_log("TSCR: Creature %u (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: %u) to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), pUnit->GetTypeId(), pUnit->GetGUID(), fX, fY, fZ, fO);
return;
}
@@ -452,7 +452,7 @@ void ScriptedAI::DoTeleportPlayer(Unit* pUnit, float fX, float fY, float fZ, flo
void ScriptedAI::DoTeleportAll(float fX, float fY, float fZ, float fO)
{
Map *map = m_creature->GetMap();
Map *map = me->GetMap();
if (!map->IsDungeon())
return;
@@ -460,15 +460,15 @@ void ScriptedAI::DoTeleportAll(float fX, float fY, float fZ, float fO)
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* i_pl = i->getSource())
if (i_pl->isAlive())
i_pl->TeleportTo(m_creature->GetMapId(), fX, fY, fZ, fO, TELE_TO_NOT_LEAVE_COMBAT);
i_pl->TeleportTo(me->GetMapId(), fX, fY, fZ, fO, TELE_TO_NOT_LEAVE_COMBAT);
}
Unit* ScriptedAI::DoSelectLowestHpFriendly(float fRange, uint32 uiMinHPDiff)
{
Unit* pUnit = NULL;
Trinity::MostHPMissingInRange u_check(m_creature, fRange, uiMinHPDiff);
Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(m_creature, pUnit, u_check);
m_creature->VisitNearbyObject(fRange, searcher);
Trinity::MostHPMissingInRange u_check(me, fRange, uiMinHPDiff);
Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(me, pUnit, u_check);
me->VisitNearbyObject(fRange, searcher);
return pUnit;
}
@@ -476,18 +476,18 @@ Unit* ScriptedAI::DoSelectLowestHpFriendly(float fRange, uint32 uiMinHPDiff)
std::list<Creature*> ScriptedAI::DoFindFriendlyCC(float fRange)
{
std::list<Creature*> pList;
Trinity::FriendlyCCedInRange u_check(m_creature, fRange);
Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange> searcher(m_creature, pList, u_check);
m_creature->VisitNearbyObject(fRange, searcher);
Trinity::FriendlyCCedInRange u_check(me, fRange);
Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange> searcher(me, pList, u_check);
me->VisitNearbyObject(fRange, searcher);
return pList;
}
std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float fRange, uint32 uiSpellid)
{
std::list<Creature*> pList;
Trinity::FriendlyMissingBuffInRange u_check(m_creature, fRange, uiSpellid);
Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange> searcher(m_creature, pList, u_check);
m_creature->VisitNearbyObject(fRange, searcher);
Trinity::FriendlyMissingBuffInRange u_check(me, fRange, uiSpellid);
Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange> searcher(me, pList, u_check);
me->VisitNearbyObject(fRange, searcher);
return pList;
}
@@ -495,16 +495,16 @@ Player* ScriptedAI::GetPlayerAtMinimumRange(float fMinimumRange)
{
Player* pPlayer = NULL;
CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
CellPair pair(Trinity::ComputeCellPair(me->GetPositionX(), me->GetPositionY()));
Cell cell(pair);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
Trinity::PlayerAtMinimumRangeAway check(m_creature, fMinimumRange);
Trinity::PlayerSearcher<Trinity::PlayerAtMinimumRangeAway> searcher(m_creature, pPlayer, check);
Trinity::PlayerAtMinimumRangeAway check(me, fMinimumRange);
Trinity::PlayerSearcher<Trinity::PlayerAtMinimumRangeAway> searcher(me, pPlayer, check);
TypeContainerVisitor<Trinity::PlayerSearcher<Trinity::PlayerAtMinimumRangeAway>, GridTypeMapContainer> visitor(searcher);
cell.Visit(pair, visitor, *(m_creature->GetMap()));
cell.Visit(pair, visitor, *(me->GetMap()));
return pPlayer;
}
@@ -513,20 +513,20 @@ void ScriptedAI::SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand, int32 ui
{
if (bLoadDefault)
{
if (CreatureInfo const* pInfo = GetCreatureTemplateStore(m_creature->GetEntry()))
m_creature->LoadEquipment(pInfo->equipmentId,true);
if (CreatureInfo const* pInfo = GetCreatureTemplateStore(me->GetEntry()))
me->LoadEquipment(pInfo->equipmentId,true);
return;
}
if (uiMainHand >= 0)
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(uiMainHand));
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(uiMainHand));
if (uiOffHand >= 0)
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, uint32(uiOffHand));
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, uint32(uiOffHand));
if (uiRanged >= 0)
m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, uint32(uiRanged));
me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, uint32(uiRanged));
}
void ScriptedAI::SetCombatMovement(bool bCombatMove)
@@ -554,21 +554,21 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff)
return false;
}
if (m_creature->IsInEvadeMode() || !m_creature->getVictim())
if (me->IsInEvadeMode() || !me->getVictim())
return false;
float fX = m_creature->GetPositionX();
float fY = m_creature->GetPositionY();
float fZ = m_creature->GetPositionZ();
float fX = me->GetPositionX();
float fY = me->GetPositionY();
float fZ = me->GetPositionZ();
switch(m_creature->GetEntry())
switch(me->GetEntry())
{
case NPC_BROODLORD: // broodlord (not move down stairs)
if (fZ > 448.60f)
return false;
break;
case NPC_VOID_REAVER: // void reaver (calculate from center of room)
if (m_creature->GetDistance2d(432.59f, 371.93f) < 105.0f)
if (me->GetDistance2d(432.59f, 371.93f) < 105.0f)
return false;
break;
case NPC_JAN_ALAI: // jan'alai (calculate by Z)
@@ -580,7 +580,7 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff)
return false;
break;
default:
error_log("TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition.", m_creature->GetEntry());
error_log("TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition.", me->GetEntry());
return false;
}
@@ -593,7 +593,7 @@ void Scripted_NoMovementAI::AttackStart(Unit* pWho)
if (!pWho)
return;
if (m_creature->Attack(pWho, true))
if (me->Attack(pWho, true))
{
DoStartNoMovement(pWho);
}
+7 -7
View File
@@ -29,7 +29,7 @@ class ScriptedInstance;
class SummonList : public std::list<uint64>
{
public:
explicit SummonList(Creature* creature) : m_creature(creature) {}
explicit SummonList(Creature* creature) : me(creature) {}
void Summon(Creature *summon) { push_back(summon->GetGUID()); }
void Despawn(Creature *summon) { remove(summon->GetGUID()); }
void DespawnEntry(uint32 entry);
@@ -37,7 +37,7 @@ class SummonList : public std::list<uint64>
void DoAction(uint32 entry, uint32 info);
void DoZoneInCombat(uint32 entry = 0);
private:
Creature *m_creature;
Creature *me;
};
struct ScriptedAI : public CreatureAI
@@ -86,7 +86,7 @@ struct ScriptedAI : public CreatureAI
//*************
//Pointer to creature we are manipulating
Creature* m_creature;
Creature* me;
//For fleeing
bool IsFleeing;
@@ -144,16 +144,16 @@ struct ScriptedAI : public CreatureAI
//Returns a list of all friendly units missing a specific buff within range
std::list<Creature*> DoFindFriendlyMissingBuff(float fRange, uint32 uiSpellId);
//Return a player with at least minimumRange from m_creature
//Return a player with at least minimumRange from me
Player* GetPlayerAtMinimumRange(float fMinimumRange);
//Spawns a creature relative to m_creature
//Spawns a creature relative to me
Creature* DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ, float fAngle, uint32 uiType, uint32 uiDespawntime);
//Selects a unit from the creature's current aggro list
Unit* SelectUnit(SelectAggroTarget pTarget, uint32 uiPosition);
bool HealthBelowPct(uint32 pct) const { return me->GetHealth() * 100 < m_creature->GetMaxHealth() * pct; }
bool HealthBelowPct(uint32 pct) const { return me->GetHealth() * 100 < me->GetMaxHealth() * pct; }
//Returns spells that meet the specified criteria from the creatures spell list
SpellEntry const* SelectSpell(Unit* Target, int32 School, int32 Mechanic, SelectTargetType Targets, uint32 PowerCostMin, uint32 PowerCostMax, float RangeMin, float RangeMax, SelectEffect Effect);
@@ -238,7 +238,7 @@ struct Scripted_NoMovementAI : public ScriptedAI
Scripted_NoMovementAI(Creature* creature) : ScriptedAI(creature) {}
virtual ~Scripted_NoMovementAI() {}
//Called at each attack of m_creature by any victim
//Called at each attack of me by any victim
void AttackStart(Unit* who);
};
+58 -58
View File
@@ -39,13 +39,13 @@ void npc_escortAI::AttackStart(Unit* pWho)
if (!pWho)
return;
if (m_creature->Attack(pWho, true))
if (me->Attack(pWho, true))
{
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
m_creature->GetMotionMaster()->MovementExpired();
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
me->GetMotionMaster()->MovementExpired();
if (IsCombatMovement())
m_creature->GetMotionMaster()->MoveChase(pWho);
me->GetMotionMaster()->MoveChase(pWho);
}
}
@@ -56,7 +56,7 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* pWho)
return false;
//experimental (unknown) flag not present
if (!(m_creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK13))
if (!(me->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK13))
return false;
//not a player
@@ -64,22 +64,22 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* pWho)
return false;
//never attack friendly
if (m_creature->IsFriendlyTo(pWho))
if (me->IsFriendlyTo(pWho))
return false;
//too far away and no free sight?
if (m_creature->IsWithinDistInMap(pWho, GetMaxPlayerDistance()) && m_creature->IsWithinLOSInMap(pWho))
if (me->IsWithinDistInMap(pWho, GetMaxPlayerDistance()) && me->IsWithinLOSInMap(pWho))
{
//already fighting someone?
if (!m_creature->getVictim())
if (!me->getVictim())
{
AttackStart(pWho);
return true;
}
else
{
pWho->SetInCombatWith(m_creature);
m_creature->AddThreat(pWho, 0.0f);
pWho->SetInCombatWith(me);
me->AddThreat(pWho, 0.0f);
return true;
}
}
@@ -89,28 +89,28 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* pWho)
void npc_escortAI::MoveInLineOfSight(Unit* pWho)
{
if (!m_creature->hasUnitState(UNIT_STAT_STUNNED) && pWho->isTargetableForAttack() && pWho->isInAccessiblePlaceFor(m_creature))
if (!me->hasUnitState(UNIT_STAT_STUNNED) && pWho->isTargetableForAttack() && pWho->isInAccessiblePlaceFor(me))
{
if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(pWho))
return;
if (!m_creature->canFly() && m_creature->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE)
if (!me->canFly() && me->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE)
return;
if (m_creature->IsHostileTo(pWho))
if (me->IsHostileTo(pWho))
{
float fAttackRadius = m_creature->GetAttackDistance(pWho);
if (m_creature->IsWithinDistInMap(pWho, fAttackRadius) && m_creature->IsWithinLOSInMap(pWho))
float fAttackRadius = me->GetAttackDistance(pWho);
if (me->IsWithinDistInMap(pWho, fAttackRadius) && me->IsWithinLOSInMap(pWho))
{
if (!m_creature->getVictim())
if (!me->getVictim())
{
pWho->RemoveAurasDueToSpell(SPELL_AURA_MOD_STEALTH);
AttackStart(pWho);
}
else if (m_creature->GetMap()->IsDungeon())
else if (me->GetMap()->IsDungeon())
{
pWho->SetInCombatWith(m_creature);
m_creature->AddThreat(pWho, 0.0f);
pWho->SetInCombatWith(me);
me->AddThreat(pWho, 0.0f);
}
}
}
@@ -153,7 +153,7 @@ void npc_escortAI::JustRespawned()
//add a small delay before going to first waypoint, normal in near all cases
m_uiWPWaitTimer = 2500;
if (m_creature->getFaction() != m_creature->GetCreatureInfo()->faction_A)
if (me->getFaction() != me->GetCreatureInfo()->faction_A)
me->RestoreFaction();
Reset();
@@ -162,16 +162,16 @@ void npc_escortAI::JustRespawned()
void npc_escortAI::ReturnToLastPoint()
{
float x, y, z, o;
m_creature->GetHomePosition(x, y, z, o);
m_creature->GetMotionMaster()->MovePoint(POINT_LAST_POINT, x, y, z);
me->GetHomePosition(x, y, z, o);
me->GetMotionMaster()->MovePoint(POINT_LAST_POINT, x, y, z);
}
void npc_escortAI::EnterEvadeMode()
{
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop(true);
m_creature->SetLootRecipient(NULL);
me->RemoveAllAuras();
me->DeleteThreatList();
me->CombatStop(true);
me->SetLootRecipient(NULL);
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
@@ -181,7 +181,7 @@ void npc_escortAI::EnterEvadeMode()
}
else
{
m_creature->GetMotionMaster()->MoveTargetedHome();
me->GetMotionMaster()->MoveTargetedHome();
Reset();
}
}
@@ -196,7 +196,7 @@ bool npc_escortAI::IsPlayerOrGroupInRange()
{
Player* pMember = pRef->getSource();
if (pMember && m_creature->IsWithinDistInMap(pMember, GetMaxPlayerDistance()))
if (pMember && me->IsWithinDistInMap(pMember, GetMaxPlayerDistance()))
{
return true;
break;
@@ -205,7 +205,7 @@ bool npc_escortAI::IsPlayerOrGroupInRange()
}
else
{
if (m_creature->IsWithinDistInMap(pPlayer, GetMaxPlayerDistance()))
if (me->IsWithinDistInMap(pPlayer, GetMaxPlayerDistance()))
return true;
}
}
@@ -215,7 +215,7 @@ bool npc_escortAI::IsPlayerOrGroupInRange()
void npc_escortAI::UpdateAI(const uint32 uiDiff)
{
//Waypoint Updating
if (HasEscortState(STATE_ESCORT_ESCORTING) && !m_creature->getVictim() && m_uiWPWaitTimer && !HasEscortState(STATE_ESCORT_RETURNING))
if (HasEscortState(STATE_ESCORT_ESCORTING) && !me->getVictim() && m_uiWPWaitTimer && !HasEscortState(STATE_ESCORT_RETURNING))
{
if (m_uiWPWaitTimer <= uiDiff)
{
@@ -229,9 +229,9 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
if (m_bCanReturnToStart)
{
float fRetX, fRetY, fRetZ;
m_creature->GetRespawnCoord(fRetX, fRetY, fRetZ);
me->GetRespawnCoord(fRetX, fRetY, fRetZ);
m_creature->GetMotionMaster()->MovePoint(POINT_HOME, fRetX, fRetY, fRetZ);
me->GetMotionMaster()->MovePoint(POINT_HOME, fRetX, fRetY, fRetZ);
m_uiWPWaitTimer = 0;
@@ -241,11 +241,11 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
if (m_bCanInstantRespawn)
{
m_creature->setDeathState(JUST_DIED);
m_creature->Respawn();
me->setDeathState(JUST_DIED);
me->Respawn();
}
else
m_creature->ForcedDespawn();
me->ForcedDespawn();
return;
}
@@ -259,7 +259,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
if (!HasEscortState(STATE_ESCORT_PAUSED))
{
m_creature->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
me->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
debug_log("TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
WaypointStart(CurrentWP->id);
@@ -272,7 +272,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
}
//Check if player or any member of his group is within range
if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPlayerGUID && !m_creature->getVictim() && !HasEscortState(STATE_ESCORT_RETURNING))
if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPlayerGUID && !me->getVictim() && !HasEscortState(STATE_ESCORT_RETURNING))
{
if (m_uiPlayerCheckTimer <= uiDiff)
{
@@ -282,11 +282,11 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
if (m_bCanInstantRespawn)
{
m_creature->setDeathState(JUST_DIED);
m_creature->Respawn();
me->setDeathState(JUST_DIED);
me->Respawn();
}
else
m_creature->ForcedDespawn();
me->ForcedDespawn();
return;
}
@@ -318,10 +318,10 @@ void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
{
debug_log("TSCR: EscortAI has returned to original position before combat");
if (m_bIsRunning && m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
else if (!m_bIsRunning && !m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
if (m_bIsRunning && me->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
else if (!m_bIsRunning && !me->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
me->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
RemoveEscortState(STATE_ESCORT_RETURNING);
@@ -340,7 +340,7 @@ void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
//Make sure that we are still on the right waypoint
if (CurrentWP->id != uiPointId)
{
error_log("TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", uiPointId, CurrentWP->id, m_creature->GetEntry());
error_log("TSCR ERROR: EscortAI reached waypoint out of order %u, expected %u, creature entry %u", uiPointId, CurrentWP->id, me->GetEntry());
return;
}
@@ -363,12 +363,12 @@ void npc_escortAI::OnPossess(bool apply)
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
if (apply)
m_creature->GetPosition(LastPos.x, LastPos.y, LastPos.z);
me->GetPosition(LastPos.x, LastPos.y, LastPos.z);
else
{
Returning = true;
m_creature->GetMotionMaster()->MovementExpired();
m_creature->GetMotionMaster()->MovePoint(WP_LAST_POINT, LastPos.x, LastPos.y, LastPos.z);
me->GetMotionMaster()->MovementExpired();
me->GetMotionMaster()->MovePoint(WP_LAST_POINT, LastPos.x, LastPos.y, LastPos.z);
}
}
}
@@ -394,7 +394,7 @@ void npc_escortAI::AddWaypoint(uint32 id, float x, float y, float z, uint32 Wait
void npc_escortAI::FillPointMovementListForCreature()
{
std::vector<ScriptPointMove> const &pPointsEntries = pSystemMgr.GetPointMoveList(m_creature->GetEntry());
std::vector<ScriptPointMove> const &pPointsEntries = pSystemMgr.GetPointMoveList(me->GetEntry());
if (pPointsEntries.empty())
return;
@@ -413,14 +413,14 @@ void npc_escortAI::SetRun(bool bRun)
if (bRun)
{
if (!m_bIsRunning)
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
else
debug_log("TSCR: EscortAI attempt to set run mode, but is already running.");
}
else
{
if (m_bIsRunning)
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
me->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
else
debug_log("TSCR: EscortAI attempt to set walk mode, but is already walking.");
}
@@ -430,7 +430,7 @@ void npc_escortAI::SetRun(bool bRun)
//TODO: get rid of this many variables passed in function.
void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID, const Quest* pQuest, bool bInstantRespawn, bool bCanLoopPath)
{
if (m_creature->getVictim())
if (me->getVictim())
{
error_log("TSCR ERROR: EscortAI attempt to Start while in combat.");
return;
@@ -471,15 +471,15 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID,
if (m_bCanReturnToStart && m_bCanInstantRespawn)
debug_log("TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
m_creature->GetMotionMaster()->MovementExpired();
m_creature->GetMotionMaster()->MoveIdle();
me->GetMotionMaster()->MovementExpired();
me->GetMotionMaster()->MoveIdle();
debug_log("TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
}
//disable npcflags
m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
debug_log("TSCR: EscortAI started with %u waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %u", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
@@ -487,9 +487,9 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID,
//Set initial speed
if (m_bIsRunning)
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
else
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
me->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
AddEscortState(STATE_ESCORT_ESCORTING);
}
+1 -1
View File
@@ -83,7 +83,7 @@ struct npc_escortAI : public ScriptedAI
uint64 GetEventStarterGUID() { return m_uiPlayerGUID; }
protected:
Player* GetPlayerForEscort() { return (Player*)Unit::GetUnit(*m_creature, m_uiPlayerGUID); }
Player* GetPlayerForEscort() { return (Player*)Unit::GetUnit(*me, m_uiPlayerGUID); }
private:
bool AssistPlayerInCombat(Unit* pWho);
+60 -60
View File
@@ -31,22 +31,22 @@ void FollowerAI::AttackStart(Unit* pWho)
if (!pWho)
return;
if (m_creature->Attack(pWho, true))
if (me->Attack(pWho, true))
{
m_creature->AddThreat(pWho, 0.0f);
m_creature->SetInCombatWith(pWho);
pWho->SetInCombatWith(m_creature);
me->AddThreat(pWho, 0.0f);
me->SetInCombatWith(pWho);
pWho->SetInCombatWith(me);
if (m_creature->hasUnitState(UNIT_STAT_FOLLOW))
m_creature->clearUnitState(UNIT_STAT_FOLLOW);
if (me->hasUnitState(UNIT_STAT_FOLLOW))
me->clearUnitState(UNIT_STAT_FOLLOW);
if (IsCombatMovement())
m_creature->GetMotionMaster()->MoveChase(pWho);
me->GetMotionMaster()->MoveChase(pWho);
}
}
//This part provides assistance to a player that are attacked by pWho, even if out of normal aggro range
//It will cause m_creature to attack pWho that are attacking _any_ player (which has been confirmed may happen also on offi)
//It will cause me to attack pWho that are attacking _any_ player (which has been confirmed may happen also on offi)
//The flag (type_flag) is unconfirmed, but used here for further research and is a good candidate.
bool FollowerAI::AssistPlayerInCombat(Unit* pWho)
{
@@ -54,7 +54,7 @@ bool FollowerAI::AssistPlayerInCombat(Unit* pWho)
return false;
//experimental (unknown) flag not present
if (!(m_creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK13))
if (!(me->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK13))
return false;
//not a player
@@ -62,22 +62,22 @@ bool FollowerAI::AssistPlayerInCombat(Unit* pWho)
return false;
//never attack friendly
if (m_creature->IsFriendlyTo(pWho))
if (me->IsFriendlyTo(pWho))
return false;
//too far away and no free sight?
if (m_creature->IsWithinDistInMap(pWho, MAX_PLAYER_DISTANCE) && m_creature->IsWithinLOSInMap(pWho))
if (me->IsWithinDistInMap(pWho, MAX_PLAYER_DISTANCE) && me->IsWithinLOSInMap(pWho))
{
//already fighting someone?
if (!m_creature->getVictim())
if (!me->getVictim())
{
AttackStart(pWho);
return true;
}
else
{
pWho->SetInCombatWith(m_creature);
m_creature->AddThreat(pWho, 0.0f);
pWho->SetInCombatWith(me);
me->AddThreat(pWho, 0.0f);
return true;
}
}
@@ -87,28 +87,28 @@ bool FollowerAI::AssistPlayerInCombat(Unit* pWho)
void FollowerAI::MoveInLineOfSight(Unit* pWho)
{
if (!m_creature->hasUnitState(UNIT_STAT_STUNNED) && pWho->isTargetableForAttack() && pWho->isInAccessiblePlaceFor(m_creature))
if (!me->hasUnitState(UNIT_STAT_STUNNED) && pWho->isTargetableForAttack() && pWho->isInAccessiblePlaceFor(me))
{
if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(pWho))
return;
if (!m_creature->canFly() && m_creature->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE)
if (!me->canFly() && me->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE)
return;
if (m_creature->IsHostileTo(pWho))
if (me->IsHostileTo(pWho))
{
float fAttackRadius = m_creature->GetAttackDistance(pWho);
if (m_creature->IsWithinDistInMap(pWho, fAttackRadius) && m_creature->IsWithinLOSInMap(pWho))
float fAttackRadius = me->GetAttackDistance(pWho);
if (me->IsWithinDistInMap(pWho, fAttackRadius) && me->IsWithinLOSInMap(pWho))
{
if (!m_creature->getVictim())
if (!me->getVictim())
{
pWho->RemoveAurasDueToSpell(SPELL_AURA_MOD_STEALTH);
AttackStart(pWho);
}
else if (m_creature->GetMap()->IsDungeon())
else if (me->GetMap()->IsDungeon())
{
pWho->SetInCombatWith(m_creature);
m_creature->AddThreat(pWho, 0.0f);
pWho->SetInCombatWith(me);
me->AddThreat(pWho, 0.0f);
}
}
}
@@ -149,34 +149,34 @@ void FollowerAI::JustRespawned()
if (!IsCombatMovement())
SetCombatMovement(true);
if (m_creature->getFaction() != m_creature->GetCreatureInfo()->faction_A)
m_creature->setFaction(m_creature->GetCreatureInfo()->faction_A);
if (me->getFaction() != me->GetCreatureInfo()->faction_A)
me->setFaction(me->GetCreatureInfo()->faction_A);
Reset();
}
void FollowerAI::EnterEvadeMode()
{
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop(true);
m_creature->SetLootRecipient(NULL);
me->RemoveAllAuras();
me->DeleteThreatList();
me->CombatStop(true);
me->SetLootRecipient(NULL);
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
debug_log("TSCR: FollowerAI left combat, returning to CombatStartPosition.");
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
{
float fPosX, fPosY, fPosZ;
m_creature->GetPosition(fPosX, fPosY, fPosZ);
m_creature->GetMotionMaster()->MovePoint(POINT_COMBAT_START, fPosX, fPosY, fPosZ);
me->GetPosition(fPosX, fPosY, fPosZ);
me->GetMotionMaster()->MovePoint(POINT_COMBAT_START, fPosX, fPosY, fPosZ);
}
}
else
{
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
m_creature->GetMotionMaster()->MoveTargetedHome();
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
me->GetMotionMaster()->MoveTargetedHome();
}
Reset();
@@ -184,14 +184,14 @@ void FollowerAI::EnterEvadeMode()
void FollowerAI::UpdateAI(const uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !m_creature->getVictim())
if (HasFollowState(STATE_FOLLOW_INPROGRESS) && !me->getVictim())
{
if (m_uiUpdateFollowTimer <= uiDiff)
{
if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT))
{
debug_log("TSCR: FollowerAI is set completed, despawns.");
m_creature->ForcedDespawn();
me->ForcedDespawn();
return;
}
@@ -204,7 +204,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
debug_log("TSCR: FollowerAI is returning to leader.");
RemoveFollowState(STATE_FOLLOW_RETURNING);
m_creature->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
me->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
return;
}
@@ -214,7 +214,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
{
Player* pMember = pRef->getSource();
if (pMember && m_creature->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE))
if (pMember && me->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE))
{
bIsMaxRangeExceeded = false;
break;
@@ -223,7 +223,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
}
else
{
if (m_creature->IsWithinDistInMap(pPlayer, MAX_PLAYER_DISTANCE))
if (me->IsWithinDistInMap(pPlayer, MAX_PLAYER_DISTANCE))
bIsMaxRangeExceeded = false;
}
}
@@ -231,7 +231,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
if (bIsMaxRangeExceeded)
{
debug_log("TSCR: FollowerAI failed because player/group was to far away or not found");
m_creature->ForcedDespawn();
me->ForcedDespawn();
return;
}
@@ -265,13 +265,13 @@ void FollowerAI::MovementInform(uint32 uiMotionType, uint32 uiPointId)
AddFollowState(STATE_FOLLOW_RETURNING);
}
else
m_creature->ForcedDespawn();
me->ForcedDespawn();
}
}
void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const Quest* pQuest)
{
if (m_creature->getVictim())
if (me->getVictim())
{
debug_log("TSCR: FollowerAI attempt to StartFollow while in combat.");
return;
@@ -287,22 +287,22 @@ void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const
m_uiLeaderGUID = pLeader->GetGUID();
if (uiFactionForFollower)
m_creature->setFaction(uiFactionForFollower);
me->setFaction(uiFactionForFollower);
m_pQuestForFollow = pQuest;
if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
debug_log("TSCR: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
}
m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
AddFollowState(STATE_FOLLOW_INPROGRESS);
m_creature->GetMotionMaster()->MoveFollow(pLeader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
me->GetMotionMaster()->MoveFollow(pLeader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
debug_log("TSCR: FollowerAI start follow %s (GUID %u)", pLeader->GetName(), m_uiLeaderGUID);
}
@@ -321,7 +321,7 @@ Player* FollowerAI::GetLeaderForFollower()
{
Player* pMember = pRef->getSource();
if (pMember && pMember->isAlive() && m_creature->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE))
if (pMember && pMember->isAlive() && me->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE))
{
debug_log("TSCR: FollowerAI GetLeader changed and returned new leader.");
m_uiLeaderGUID = pMember->GetGUID();
@@ -339,13 +339,13 @@ Player* FollowerAI::GetLeaderForFollower()
void FollowerAI::SetFollowComplete(bool bWithEndEvent)
{
if (m_creature->hasUnitState(UNIT_STAT_FOLLOW))
if (me->hasUnitState(UNIT_STAT_FOLLOW))
{
m_creature->clearUnitState(UNIT_STAT_FOLLOW);
me->clearUnitState(UNIT_STAT_FOLLOW);
m_creature->StopMoving();
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
me->StopMoving();
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
}
if (bWithEndEvent)
@@ -368,13 +368,13 @@ void FollowerAI::SetFollowPaused(bool bPaused)
{
AddFollowState(STATE_FOLLOW_PAUSED);
if (m_creature->hasUnitState(UNIT_STAT_FOLLOW))
if (me->hasUnitState(UNIT_STAT_FOLLOW))
{
m_creature->clearUnitState(UNIT_STAT_FOLLOW);
me->clearUnitState(UNIT_STAT_FOLLOW);
m_creature->StopMoving();
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
me->StopMoving();
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
}
}
else
@@ -382,6 +382,6 @@ void FollowerAI::SetFollowPaused(bool bPaused)
RemoveFollowState(STATE_FOLLOW_PAUSED);
if (Player* pLeader = GetLeaderForFollower())
m_creature->GetMotionMaster()->MoveFollow(pLeader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
me->GetMotionMaster()->MoveFollow(pLeader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
}
}
+34 -34
View File
@@ -45,10 +45,10 @@ void guardAI::Reset()
void guardAI::EnterCombat(Unit *who)
{
if (m_creature->GetEntry() == 15184)
DoScriptText(RAND(SAY_GUARD_SIL_AGGRO1,SAY_GUARD_SIL_AGGRO2,SAY_GUARD_SIL_AGGRO3), m_creature, who);
if (me->GetEntry() == 15184)
DoScriptText(RAND(SAY_GUARD_SIL_AGGRO1,SAY_GUARD_SIL_AGGRO2,SAY_GUARD_SIL_AGGRO3), me, who);
if (SpellEntry const *spell = m_creature->reachWithSpellAttack(who))
if (SpellEntry const *spell = me->reachWithSpellAttack(who))
DoCastSpell(who, spell);
}
@@ -56,7 +56,7 @@ void guardAI::JustDied(Unit *Killer)
{
//Send Zone Under Attack message to the LocalDefense and WorldDefense Channels
if (Player* pKiller = Killer->GetCharmerOrOwnerPlayerOrPlayerItself())
m_creature->SendZoneUnderAttackMessage(pKiller);
me->SendZoneUnderAttackMessage(pKiller);
}
void guardAI::UpdateAI(const uint32 diff)
@@ -67,16 +67,16 @@ void guardAI::UpdateAI(const uint32 diff)
else GlobalCooldown = 0;
//Buff timer (only buff when we are alive and not in combat
if (m_creature->isAlive() && !m_creature->isInCombat())
if (me->isAlive() && !me->isInCombat())
if (BuffTimer <= diff)
{
//Find a spell that targets friendly and applies an aura (these are generally buffs)
SpellEntry const *info = SelectSpell(m_creature, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA);
SpellEntry const *info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA);
if (info && !GlobalCooldown)
{
//Cast the buff spell
DoCastSpell(m_creature, info);
DoCastSpell(me, info);
//Set our global cooldown
GlobalCooldown = GENERIC_CREATURE_COOLDOWN;
@@ -92,77 +92,77 @@ void guardAI::UpdateAI(const uint32 diff)
return;
// Make sure our attack is ready and we arn't currently casting
if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false))
if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false))
{
//If we are within range melee the target
if (m_creature->IsWithinMeleeRange(m_creature->getVictim()))
if (me->IsWithinMeleeRange(me->getVictim()))
{
bool Healing = false;
SpellEntry const *info = NULL;
//Select a healing spell if less than 30% hp
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30)
info = SelectSpell(m_creature, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);
if (me->GetHealth()*100 / me->GetMaxHealth() < 30)
info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);
//No healing spell available, select a hostile spell
if (info) Healing = true;
else info = SelectSpell(m_creature->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE);
else info = SelectSpell(me->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE);
//20% chance to replace our white hit with a spell
if (info && rand() % 5 == 0 && !GlobalCooldown)
{
//Cast the spell
if (Healing)DoCastSpell(m_creature, info);
else DoCastSpell(m_creature->getVictim(), info);
if (Healing)DoCastSpell(me, info);
else DoCastSpell(me->getVictim(), info);
//Set our global cooldown
GlobalCooldown = GENERIC_CREATURE_COOLDOWN;
}
else m_creature->AttackerStateUpdate(m_creature->getVictim());
else me->AttackerStateUpdate(me->getVictim());
m_creature->resetAttackTimer();
me->resetAttackTimer();
}
}
else
{
//Only run this code if we arn't already casting
if (!m_creature->IsNonMeleeSpellCasted(false))
if (!me->IsNonMeleeSpellCasted(false))
{
bool Healing = false;
SpellEntry const *info = NULL;
//Select a healing spell if less than 30% hp ONLY 33% of the time
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30 && rand() % 3 == 0)
info = SelectSpell(m_creature, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);
if (me->GetHealth()*100 / me->GetMaxHealth() < 30 && rand() % 3 == 0)
info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING);
//No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE)
if (info) Healing = true;
else info = SelectSpell(m_creature->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE);
else info = SelectSpell(me->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE);
//Found a spell, check if we arn't on cooldown
if (info && !GlobalCooldown)
{
//If we are currently moving stop us and set the movement generator
if ((*m_creature).GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE)
if ((*me).GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE)
{
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->MoveIdle();
(*me).GetMotionMaster()->Clear(false);
(*me).GetMotionMaster()->MoveIdle();
}
//Cast spell
if (Healing) DoCastSpell(m_creature,info);
else DoCastSpell(m_creature->getVictim(),info);
if (Healing) DoCastSpell(me,info);
else DoCastSpell(me->getVictim(),info);
//Set our global cooldown
GlobalCooldown = GENERIC_CREATURE_COOLDOWN;
} //If no spells available and we arn't moving run to target
else if ((*m_creature).GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE)
else if ((*me).GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE)
{
//Cancel our current spell and then mutate new movement generator
m_creature->InterruptNonMeleeSpells(false);
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->MoveChase(m_creature->getVictim());
me->InterruptNonMeleeSpells(false);
(*me).GetMotionMaster()->Clear(false);
(*me).GetMotionMaster()->MoveChase(me->getVictim());
}
}
}
@@ -172,12 +172,12 @@ void guardAI::DoReplyToTextEmote(uint32 em)
{
switch(em)
{
case TEXTEMOTE_KISS: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break;
case TEXTEMOTE_WAVE: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break;
case TEXTEMOTE_SALUTE: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); break;
case TEXTEMOTE_SHY: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_FLEX); break;
case TEXTEMOTE_KISS: me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break;
case TEXTEMOTE_WAVE: me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break;
case TEXTEMOTE_SALUTE: me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); break;
case TEXTEMOTE_SHY: me->HandleEmoteCommand(EMOTE_ONESHOT_FLEX); break;
case TEXTEMOTE_RUDE:
case TEXTEMOTE_CHICKEN: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_POINT); break;
case TEXTEMOTE_CHICKEN: me->HandleEmoteCommand(EMOTE_ONESHOT_POINT); break;
}
}
+19 -19
View File
@@ -99,11 +99,11 @@ void SimpleAI::EnterCombat(Unit *who)
//Random text
if (Aggro_TextId[random_text])
DoScriptText(Aggro_TextId[random_text], m_creature, who);
DoScriptText(Aggro_TextId[random_text], me, who);
//Random sound
if (Aggro_Sound[random_text])
DoPlaySoundToSet(m_creature, Aggro_Sound[random_text]);
DoPlaySoundToSet(me, Aggro_Sound[random_text]);
}
void SimpleAI::KilledUnit(Unit *victim)
@@ -112,11 +112,11 @@ void SimpleAI::KilledUnit(Unit *victim)
//Random yell
if (Kill_TextId[random_text])
DoScriptText(Kill_TextId[random_text], m_creature, victim);
DoScriptText(Kill_TextId[random_text], me, victim);
//Random sound
if (Kill_Sound[random_text])
DoPlaySoundToSet(m_creature, Kill_Sound[random_text]);
DoPlaySoundToSet(me, Kill_Sound[random_text]);
if (!Kill_Spell)
return;
@@ -126,10 +126,10 @@ void SimpleAI::KilledUnit(Unit *victim)
switch (Kill_Target_Type)
{
case CAST_SELF:
pTarget = m_creature;
pTarget = me;
break;
case CAST_HOSTILE_TARGET:
pTarget = m_creature->getVictim();
pTarget = me->getVictim();
break;
case CAST_HOSTILE_SECOND_AGGRO:
pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1);
@@ -153,18 +153,18 @@ void SimpleAI::KilledUnit(Unit *victim)
void SimpleAI::DamageTaken(Unit *killer, uint32 &damage)
{
//Return if damage taken won't kill us
if (m_creature->GetHealth() > damage)
if (me->GetHealth() > damage)
return;
uint8 random_text = urand(0,2);
//Random yell
if (Death_TextId[random_text])
DoScriptText(Death_TextId[random_text], m_creature, killer);
DoScriptText(Death_TextId[random_text], me, killer);
//Random sound
if (Death_Sound[random_text])
DoPlaySoundToSet(m_creature, Death_Sound[random_text]);
DoPlaySoundToSet(me, Death_Sound[random_text]);
if (!Death_Spell)
return;
@@ -174,10 +174,10 @@ void SimpleAI::DamageTaken(Unit *killer, uint32 &damage)
switch (Death_Target_Type)
{
case CAST_SELF:
pTarget = m_creature;
pTarget = me;
break;
case CAST_HOSTILE_TARGET:
pTarget = m_creature->getVictim();
pTarget = me->getVictim();
break;
case CAST_HOSTILE_SECOND_AGGRO:
pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1);
@@ -214,21 +214,21 @@ void SimpleAI::UpdateAI(const uint32 diff)
if (Spell_Timer[i] <= diff)
{
//Check if this is a percentage based
if (Spell[i].First_Cast < 0 && Spell[i].First_Cast > -100 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() > -Spell[i].First_Cast)
if (Spell[i].First_Cast < 0 && Spell[i].First_Cast > -100 && me->GetHealth()*100 / me->GetMaxHealth() > -Spell[i].First_Cast)
continue;
//Check Current spell
if (!(Spell[i].InterruptPreviousCast && m_creature->IsNonMeleeSpellCasted(false)))
if (!(Spell[i].InterruptPreviousCast && me->IsNonMeleeSpellCasted(false)))
{
Unit *pTarget = NULL;
switch (Spell[i].Cast_Target_Type)
{
case CAST_SELF:
pTarget = m_creature;
pTarget = me;
break;
case CAST_HOSTILE_TARGET:
pTarget = m_creature->getVictim();
pTarget = me->getVictim();
break;
case CAST_HOSTILE_SECOND_AGGRO:
pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1);
@@ -244,8 +244,8 @@ void SimpleAI::UpdateAI(const uint32 diff)
//Target is ok, cast a spell on it and then do our random yell
if (pTarget)
{
if (m_creature->IsNonMeleeSpellCasted(false))
m_creature->InterruptNonMeleeSpells(false);
if (me->IsNonMeleeSpellCasted(false))
me->InterruptNonMeleeSpells(false);
DoCast(pTarget, Spell[i].Spell_Id);
@@ -255,11 +255,11 @@ void SimpleAI::UpdateAI(const uint32 diff)
//Random yell
if (Spell[i].TextId[random_text])
DoScriptText(Spell[i].TextId[random_text], m_creature, pTarget);
DoScriptText(Spell[i].TextId[random_text], me, pTarget);
//Random sound
if (Spell[i].Text_Sound[random_text])
DoPlaySoundToSet(m_creature, Spell[i].Text_Sound[random_text]);
DoPlaySoundToSet(me, Spell[i].Text_Sound[random_text]);
}
}
+17 -17
View File
@@ -50,20 +50,20 @@ TotemAI::MoveInLineOfSight(Unit *)
void TotemAI::EnterEvadeMode()
{
m_creature->CombatStop(true);
me->CombatStop(true);
}
void
TotemAI::UpdateAI(const uint32 /*diff*/)
{
if (m_creature->ToTotem()->GetTotemType() != TOTEM_ACTIVE)
if (me->ToTotem()->GetTotemType() != TOTEM_ACTIVE)
return;
if (!m_creature->isAlive() || m_creature->IsNonMeleeSpellCasted(false))
if (!me->isAlive() || me->IsNonMeleeSpellCasted(false))
return;
// Search spell
SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_creature->ToTotem()->GetSpell());
SpellEntry const *spellInfo = sSpellStore.LookupEntry(me->ToTotem()->GetSpell());
if (!spellInfo)
return;
@@ -74,17 +74,17 @@ TotemAI::UpdateAI(const uint32 /*diff*/)
// SPELLMOD_RANGE not applied in this place just because not existence range mods for attacking totems
// pointer to appropriate target if found any
Unit* victim = i_victimGuid ? ObjectAccessor::GetUnit(*m_creature, i_victimGuid) : NULL;
Unit* victim = i_victimGuid ? ObjectAccessor::GetUnit(*me, i_victimGuid) : NULL;
// Search victim if no, not attackable, or out of range, or friendly (possible in case duel end)
if (!victim ||
!victim->isTargetableForAttack() || !m_creature->IsWithinDistInMap(victim, max_range) ||
m_creature->IsFriendlyTo(victim) || !victim->isVisibleForOrDetect(m_creature,false))
!victim->isTargetableForAttack() || !me->IsWithinDistInMap(victim, max_range) ||
me->IsFriendlyTo(victim) || !victim->isVisibleForOrDetect(me,false))
{
victim = NULL;
Trinity::NearestAttackableUnitInObjectRangeCheck u_check(m_creature, m_creature, max_range);
Trinity::UnitLastSearcher<Trinity::NearestAttackableUnitInObjectRangeCheck> checker(m_creature, victim, u_check);
m_creature->VisitNearbyObject(max_range, checker);
Trinity::NearestAttackableUnitInObjectRangeCheck u_check(me, me, max_range);
Trinity::UnitLastSearcher<Trinity::NearestAttackableUnitInObjectRangeCheck> checker(me, victim, u_check);
me->VisitNearbyObject(max_range, checker);
}
// If have target
@@ -94,8 +94,8 @@ TotemAI::UpdateAI(const uint32 /*diff*/)
i_victimGuid = victim->GetGUID();
// attack
m_creature->SetInFront(victim); // client change orientation by self
m_creature->CastSpell(victim, m_creature->ToTotem()->GetSpell(), false);
me->SetInFront(victim); // client change orientation by self
me->CastSpell(victim, me->ToTotem()->GetSpell(), false);
}
else
i_victimGuid = 0;
@@ -105,12 +105,12 @@ void
TotemAI::AttackStart(Unit *)
{
// Sentry totem sends ping on attack
if (m_creature->GetEntry() == SENTRY_TOTEM_ENTRY && m_creature->GetOwner()->GetTypeId() == TYPEID_PLAYER)
if (me->GetEntry() == SENTRY_TOTEM_ENTRY && me->GetOwner()->GetTypeId() == TYPEID_PLAYER)
{
WorldPacket data(MSG_MINIMAP_PING, (8+4+4));
data << m_creature->GetGUID();
data << m_creature->GetPositionX();
data << m_creature->GetPositionY();
((Player*)m_creature->GetOwner())->GetSession()->SendPacket(&data);
data << me->GetGUID();
data << me->GetPositionX();
data << me->GetPositionY();
((Player*)me->GetOwner())->GetSession()->SendPacket(&data);
}
}
@@ -82,31 +82,31 @@ struct mob_av_marshal_or_warmasterAI : public ScriptedAI
{
if (!bHasAura)
{
switch(m_creature->GetEntry())
switch(me->GetEntry())
{
case NPC_NORTH_MARSHAL:
DoCast(m_creature,SPELL_NORTH_MARSHAL);
DoCast(me,SPELL_NORTH_MARSHAL);
break;
case NPC_SOUTH_MARSHAL:
DoCast(m_creature,SPELL_SOUTH_MARSHAL);
DoCast(me,SPELL_SOUTH_MARSHAL);
break;
case NPC_STONEHEARTH_MARSHAL:
DoCast(m_creature,SPELL_STONEHEARTH_MARSHAL);
DoCast(me,SPELL_STONEHEARTH_MARSHAL);
break;
case NPC_ICEWING_MARSHAL:
DoCast(m_creature,SPELL_ICEWING_MARSHAL);
DoCast(me,SPELL_ICEWING_MARSHAL);
break;
case NPC_EAST_FROSTWOLF_WARMASTER:
DoCast(m_creature,SPELL_EAST_FROSTWOLF_WARMASTER);
DoCast(me,SPELL_EAST_FROSTWOLF_WARMASTER);
break;
case NPC_WEST_FROSTWOLF_WARMASTER:
DoCast(m_creature,SPELL_WEST_FROSTWOLF_WARMASTER);
DoCast(me,SPELL_WEST_FROSTWOLF_WARMASTER);
break;
case NPC_ICEBLOOD_WARMASTER:
DoCast(m_creature,SPELL_ICEBLOOD_WARMASTER);
DoCast(me,SPELL_ICEBLOOD_WARMASTER);
break;
case NPC_TOWER_POINT_WARMASTER:
DoCast(m_creature,SPELL_TOWER_POINT_WARMASTER);
DoCast(me,SPELL_TOWER_POINT_WARMASTER);
break;
}
@@ -118,37 +118,37 @@ struct mob_av_marshal_or_warmasterAI : public ScriptedAI
if (uiChargeTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CHARGE);
DoCast(me->getVictim(), SPELL_CHARGE);
uiChargeTimer = urand(10*IN_MILISECONDS,25*IN_MILISECONDS);
} else uiChargeTimer -= diff;
if (uiCleaveTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
uiCleaveTimer = urand(10*IN_MILISECONDS,16*IN_MILISECONDS);
} else uiCleaveTimer -= diff;
if (uiDemoralizingShoutTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_DEMORALIZING_SHOUT);
DoCast(me->getVictim(), SPELL_DEMORALIZING_SHOUT);
uiDemoralizingShoutTimer = urand(10*IN_MILISECONDS,15*IN_MILISECONDS);
} else uiDemoralizingShoutTimer -= diff;
if (uiWhirlwind1Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WHIRLWIND1);
DoCast(me->getVictim(), SPELL_WHIRLWIND1);
uiWhirlwind1Timer = urand(6*IN_MILISECONDS,20*IN_MILISECONDS);
} else uiWhirlwind1Timer -= diff;
if (uiWhirlwind2Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WHIRLWIND2);
DoCast(me->getVictim(), SPELL_WHIRLWIND2);
uiWhirlwind2Timer = urand(10*IN_MILISECONDS,25*IN_MILISECONDS);
} else uiWhirlwind2Timer -= diff;
if (uiEnrageTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_ENRAGE);
DoCast(me->getVictim(), SPELL_ENRAGE);
uiEnrageTimer = urand(10*IN_MILISECONDS,30*IN_MILISECONDS);
}else uiEnrageTimer -= diff;
@@ -156,7 +156,7 @@ struct mob_av_marshal_or_warmasterAI : public ScriptedAI
// check if creature is not outside of building
if (uiResetTimer <= diff)
{
if (m_creature->GetDistance2d(m_creature->GetHomePosition().GetPositionX(), m_creature->GetHomePosition().GetPositionY()) > 50)
if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 50)
EnterEvadeMode();
uiResetTimer = 5*IN_MILISECONDS;
} else uiResetTimer -= diff;
@@ -61,15 +61,15 @@ struct mob_water_elementalAI : public ScriptedAI
if (uiWaterBoltTimer < diff)
{
DoCast(m_creature->getVictim(), SPELL_WATERBOLT);
DoCast(me->getVictim(), SPELL_WATERBOLT);
uiWaterBoltTimer = 5*IN_MILISECONDS;
} else uiWaterBoltTimer -= diff;
// check if creature is not outside of building
if (uiResetTimer < diff)
{
if (Creature *pBalinda = Unit::GetCreature(*m_creature, uiBalindaGUID))
if (m_creature->GetDistance2d(pBalinda->GetHomePosition().GetPositionX(), pBalinda->GetHomePosition().GetPositionY()) > 50)
if (Creature *pBalinda = Unit::GetCreature(*me, uiBalindaGUID))
if (me->GetDistance2d(pBalinda->GetHomePosition().GetPositionX(), pBalinda->GetHomePosition().GetPositionY()) > 50)
EnterEvadeMode();
uiResetTimer = 5*IN_MILISECONDS;
} else uiResetTimer -= diff;
@@ -80,7 +80,7 @@ struct mob_water_elementalAI : public ScriptedAI
struct boss_balindaAI : public ScriptedAI
{
boss_balindaAI(Creature *c) : ScriptedAI(c), Summons(m_creature) {}
boss_balindaAI(Creature *c) : ScriptedAI(c), Summons(me) {}
uint32 uiArcaneExplosionTimer;
uint32 uiConeOfColdTimer;
@@ -105,7 +105,7 @@ struct boss_balindaAI : public ScriptedAI
void EnterCombat(Unit *who)
{
DoScriptText(YELL_AGGRO, m_creature);
DoScriptText(YELL_AGGRO, me);
}
void JustRespawned()
@@ -115,9 +115,9 @@ struct boss_balindaAI : public ScriptedAI
void JustSummoned(Creature* summoned)
{
((mob_water_elementalAI*)summoned->AI())->uiBalindaGUID = m_creature->GetGUID();
((mob_water_elementalAI*)summoned->AI())->uiBalindaGUID = me->GetGUID();
summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM,0, 50, true));
summoned->setFaction(m_creature->getFaction());
summoned->setFaction(me->getFaction());
Summons.Summon(summoned);
}
@@ -134,31 +134,31 @@ struct boss_balindaAI : public ScriptedAI
if (uiWaterElementalTimer < diff)
{
if (Summons.empty())
m_creature->SummonCreature(NPC_WATER_ELEMENTAL, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45*IN_MILISECONDS);
me->SummonCreature(NPC_WATER_ELEMENTAL, 0, 0, 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45*IN_MILISECONDS);
uiWaterElementalTimer = 50*IN_MILISECONDS;
} else uiWaterElementalTimer -= diff;
if (uiArcaneExplosionTimer < diff)
{
DoCast(m_creature->getVictim(), SPELL_ARCANE_EXPLOSION);
DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION);
uiArcaneExplosionTimer = urand(5*IN_MILISECONDS,15*IN_MILISECONDS);
} else uiArcaneExplosionTimer -= diff;
if (uiConeOfColdTimer < diff)
{
DoCast(m_creature->getVictim(), SPELL_CONE_OF_COLD);
DoCast(me->getVictim(), SPELL_CONE_OF_COLD);
uiConeOfColdTimer = urand(10*IN_MILISECONDS,20*IN_MILISECONDS);
} else uiConeOfColdTimer -= diff;
if (uiFireBoltTimer < diff)
{
DoCast(m_creature->getVictim(), SPELL_FIREBALL);
DoCast(me->getVictim(), SPELL_FIREBALL);
uiFireBoltTimer = urand(5*IN_MILISECONDS,9*IN_MILISECONDS);
} else uiFireBoltTimer -= diff;
if (uiFrostboltTimer < diff)
{
DoCast(m_creature->getVictim(), SPELL_FROSTBOLT);
DoCast(me->getVictim(), SPELL_FROSTBOLT);
uiFrostboltTimer = urand(4*IN_MILISECONDS,12*IN_MILISECONDS);
} else uiFrostboltTimer -= diff;
@@ -166,10 +166,10 @@ struct boss_balindaAI : public ScriptedAI
// check if creature is not outside of building
if (uiResetTimer < diff)
{
if (m_creature->GetDistance2d(m_creature->GetHomePosition().GetPositionX(), m_creature->GetHomePosition().GetPositionY()) > 50)
if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 50)
{
EnterEvadeMode();
DoScriptText(YELL_EVADE, m_creature);
DoScriptText(YELL_EVADE, me);
}
uiResetTimer = 5*IN_MILISECONDS;
} else uiResetTimer -= diff;
@@ -63,13 +63,13 @@ struct boss_drektharAI : public ScriptedAI
void Aggro(Unit *who)
{
DoScriptText(YELL_AGGRO, m_creature);
DoScriptText(YELL_AGGRO, me);
}
void JustRespawned()
{
Reset();
DoScriptText(YELL_RESPAWN, m_creature);
DoScriptText(YELL_RESPAWN, me);
}
void UpdateAI(const uint32 diff)
@@ -79,41 +79,41 @@ struct boss_drektharAI : public ScriptedAI
if (uiWhirlwindTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WHIRLWIND);
DoCast(me->getVictim(), SPELL_WHIRLWIND);
uiWhirlwindTimer = urand(8*IN_MILISECONDS,18*IN_MILISECONDS);
} else uiWhirlwindTimer -= diff;
if (uiWhirlwind2Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WHIRLWIND2);
DoCast(me->getVictim(), SPELL_WHIRLWIND2);
uiWhirlwind2Timer = urand(7*IN_MILISECONDS,25*IN_MILISECONDS);
} else uiWhirlwind2Timer -= diff;
if (uiKnockdownTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_KNOCKDOWN);
DoCast(me->getVictim(), SPELL_KNOCKDOWN);
uiKnockdownTimer = urand(10*IN_MILISECONDS,15*IN_MILISECONDS);
} else uiKnockdownTimer -= diff;
if (uiFrenzyTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FRENZY);
DoCast(me->getVictim(), SPELL_FRENZY);
uiFrenzyTimer = urand(20*IN_MILISECONDS,30*IN_MILISECONDS);
} else uiFrenzyTimer -= diff;
if (uiYellTimer <= diff)
{
DoScriptText(RAND(YELL_RANDOM1,YELL_RANDOM2,YELL_RANDOM3,YELL_RANDOM4,YELL_RANDOM5), m_creature);
DoScriptText(RAND(YELL_RANDOM1,YELL_RANDOM2,YELL_RANDOM3,YELL_RANDOM4,YELL_RANDOM5), me);
uiYellTimer = urand(20*IN_MILISECONDS,30*IN_MILISECONDS); //20 to 30 seconds
} else uiYellTimer -= diff;
// check if creature is not outside of building
if (uiResetTimer <= diff)
{
if (m_creature->GetDistance2d(m_creature->GetHomePosition().GetPositionX(), m_creature->GetHomePosition().GetPositionY()) > 50)
if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 50)
{
EnterEvadeMode();
DoScriptText(YELL_EVADE, m_creature);
DoScriptText(YELL_EVADE, me);
}
uiResetTimer = 5*IN_MILISECONDS;
} else uiResetTimer -= diff;
@@ -56,7 +56,7 @@ struct boss_galvangarAI : public ScriptedAI
void Aggro(Unit *who)
{
DoScriptText(YELL_AGGRO, m_creature);
DoScriptText(YELL_AGGRO, me);
}
void JustRespawned()
@@ -71,41 +71,41 @@ struct boss_galvangarAI : public ScriptedAI
if (uiCleaveTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
uiCleaveTimer = urand(10*IN_MILISECONDS,16*IN_MILISECONDS);
} else uiCleaveTimer -= diff;
if (uiFrighteningShoutTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FRIGHTENING_SHOUT);
DoCast(me->getVictim(), SPELL_FRIGHTENING_SHOUT);
uiFrighteningShoutTimer = urand(10*IN_MILISECONDS,15*IN_MILISECONDS);
} else uiFrighteningShoutTimer -= diff;
if (uiWhirlwind1Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WHIRLWIND1);
DoCast(me->getVictim(), SPELL_WHIRLWIND1);
uiWhirlwind1Timer = urand(6*IN_MILISECONDS,10*IN_MILISECONDS);
} else uiWhirlwind1Timer -= diff;
if (uiWhirlwind2Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WHIRLWIND2);
DoCast(me->getVictim(), SPELL_WHIRLWIND2);
uiWhirlwind2Timer = urand(10*IN_MILISECONDS,25*IN_MILISECONDS);
} else uiWhirlwind2Timer -= diff;
if (uiMortalStrikeTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_MORTAL_STRIKE);
DoCast(me->getVictim(), SPELL_MORTAL_STRIKE);
uiMortalStrikeTimer = urand(10*IN_MILISECONDS,30*IN_MILISECONDS);
} else uiMortalStrikeTimer -= diff;
// check if creature is not outside of building
if (uiResetTimer <= diff)
{
if (m_creature->GetDistance2d(m_creature->GetHomePosition().GetPositionX(), m_creature->GetHomePosition().GetPositionY()) > 50)
if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 50)
{
EnterEvadeMode();
DoScriptText(YELL_EVADE, m_creature);
DoScriptText(YELL_EVADE, me);
}
uiResetTimer = 5*IN_MILISECONDS;
} else uiResetTimer -= diff;
@@ -61,13 +61,13 @@ struct boss_vanndarAI : public ScriptedAI
void Aggro(Unit *who)
{
DoScriptText(YELL_AGGRO, m_creature);
DoScriptText(YELL_AGGRO, me);
}
void JustRespawned()
{
Reset();
DoScriptText(RAND(YELL_RESPAWN1,YELL_RESPAWN2), m_creature);
DoScriptText(RAND(YELL_RESPAWN1,YELL_RESPAWN2), me);
}
void UpdateAI(const uint32 diff)
@@ -77,35 +77,35 @@ struct boss_vanndarAI : public ScriptedAI
if (uiAvatarTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_AVATAR);
DoCast(me->getVictim(), SPELL_AVATAR);
uiAvatarTimer = urand(15*IN_MILISECONDS,20*IN_MILISECONDS);
} else uiAvatarTimer -= diff;
if (uiThunderclapTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_THUNDERCLAP);
DoCast(me->getVictim(), SPELL_THUNDERCLAP);
uiThunderclapTimer = urand(5*IN_MILISECONDS,15*IN_MILISECONDS);
} else uiThunderclapTimer -= diff;
if (uiStormboltTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_STORMBOLT);
DoCast(me->getVictim(), SPELL_STORMBOLT);
uiStormboltTimer = urand(10*IN_MILISECONDS,25*IN_MILISECONDS);
} else uiStormboltTimer -= diff;
if (uiYellTimer <= diff)
{
DoScriptText(RAND(YELL_RANDOM1,YELL_RANDOM2,YELL_RANDOM3,YELL_RANDOM4,YELL_RANDOM5,YELL_RANDOM6,YELL_RANDOM7), m_creature);
DoScriptText(RAND(YELL_RANDOM1,YELL_RANDOM2,YELL_RANDOM3,YELL_RANDOM4,YELL_RANDOM5,YELL_RANDOM6,YELL_RANDOM7), me);
uiYellTimer = urand(20*IN_MILISECONDS,30*IN_MILISECONDS); //20 to 30 seconds
} else uiYellTimer -= diff;
// check if creature is not outside of building
if (uiResetTimer <= diff)
{
if (m_creature->GetDistance2d(m_creature->GetHomePosition().GetPositionX(), m_creature->GetHomePosition().GetPositionY()) > 50)
if (me->GetDistance2d(me->GetHomePosition().GetPositionX(), me->GetHomePosition().GetPositionY()) > 50)
{
EnterEvadeMode();
DoScriptText(YELL_EVADE, m_creature);
DoScriptText(YELL_EVADE, me);
}
uiResetTimer = 5*IN_MILISECONDS;
} else uiResetTimer -= diff;
@@ -62,38 +62,38 @@ struct npc_professor_phizzlethorpeAI : public npc_escortAI
switch(uiPointId)
{
case 4:DoScriptText(SAY_PROGRESS_2, m_creature, pPlayer);break;
case 5:DoScriptText(SAY_PROGRESS_3, m_creature, pPlayer);break;
case 8:DoScriptText(EMOTE_PROGRESS_4, m_creature);break;
case 4:DoScriptText(SAY_PROGRESS_2, me, pPlayer);break;
case 5:DoScriptText(SAY_PROGRESS_3, me, pPlayer);break;
case 8:DoScriptText(EMOTE_PROGRESS_4, me);break;
case 9:
{
m_creature->SummonCreature(MOB_VENGEFUL_SURGE, -2052.96, -2142.49, 20.15, 1.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
m_creature->SummonCreature(MOB_VENGEFUL_SURGE, -2052.96, -2142.49, 20.15, 1.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
me->SummonCreature(MOB_VENGEFUL_SURGE, -2052.96, -2142.49, 20.15, 1.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
me->SummonCreature(MOB_VENGEFUL_SURGE, -2052.96, -2142.49, 20.15, 1.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
break;
}
case 10:DoScriptText(SAY_PROGRESS_5, m_creature, pPlayer);break;
case 10:DoScriptText(SAY_PROGRESS_5, me, pPlayer);break;
case 11:
DoScriptText(SAY_PROGRESS_6, m_creature, pPlayer);
DoScriptText(SAY_PROGRESS_6, me, pPlayer);
SetRun();
break;
case 19:DoScriptText(SAY_PROGRESS_7, m_creature, pPlayer); break;
case 19:DoScriptText(SAY_PROGRESS_7, me, pPlayer); break;
case 20:
DoScriptText(EMOTE_PROGRESS_8, m_creature);
DoScriptText(SAY_PROGRESS_9, m_creature, pPlayer);
DoScriptText(EMOTE_PROGRESS_8, me);
DoScriptText(SAY_PROGRESS_9, me, pPlayer);
if (pPlayer)
CAST_PLR(pPlayer)->GroupEventHappens(QUEST_SUNKEN_TREASURE, m_creature);
CAST_PLR(pPlayer)->GroupEventHappens(QUEST_SUNKEN_TREASURE, me);
break;
}
}
void JustSummoned(Creature* pSummoned)
{
pSummoned->AI()->AttackStart(m_creature);
pSummoned->AI()->AttackStart(me);
}
void EnterCombat(Unit* pWho)
{
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
}
void UpdateAI(const uint32 diff)
@@ -148,7 +148,7 @@ struct npc_grimstoneAI : public npc_escortAI
void Reset()
{
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
EventPhase = 0;
Event_Timer = 1000;
@@ -167,7 +167,7 @@ struct npc_grimstoneAI : public npc_escortAI
//TODO: move them to center
void SummonRingMob()
{
if (Creature* tmp = m_creature->SummonCreature(RingMob[MobSpawnId],608.960,-235.322,-53.907,1.857,TEMPSUMMON_DEAD_DESPAWN,0))
if (Creature* tmp = me->SummonCreature(RingMob[MobSpawnId],608.960,-235.322,-53.907,1.857,TEMPSUMMON_DEAD_DESPAWN,0))
RingMobGUID[MobCount] = tmp->GetGUID();
++MobCount;
@@ -179,7 +179,7 @@ struct npc_grimstoneAI : public npc_escortAI
//TODO: move them to center
void SummonRingBoss()
{
if (Creature* tmp = m_creature->SummonCreature(RingBoss[rand()%6],644.300,-175.989,-53.739,3.418,TEMPSUMMON_DEAD_DESPAWN,0))
if (Creature* tmp = me->SummonCreature(RingBoss[rand()%6],644.300,-175.989,-53.739,3.418,TEMPSUMMON_DEAD_DESPAWN,0))
RingBossGUID = tmp->GetGUID();
MobDeath_Timer = 2500;
@@ -190,12 +190,12 @@ struct npc_grimstoneAI : public npc_escortAI
switch(i)
{
case 0:
DoScriptText(SCRIPT_TEXT1, m_creature);//2
DoScriptText(SCRIPT_TEXT1, me);//2
CanWalk = false;
Event_Timer = 5000;
break;
case 1:
DoScriptText(SCRIPT_TEXT2, m_creature);//4
DoScriptText(SCRIPT_TEXT2, me);//4
CanWalk = false;
Event_Timer = 5000;
break;
@@ -203,10 +203,10 @@ struct npc_grimstoneAI : public npc_escortAI
CanWalk = false;
break;
case 3:
DoScriptText(SCRIPT_TEXT3, m_creature);//5
DoScriptText(SCRIPT_TEXT3, me);//5
break;
case 4:
DoScriptText(SCRIPT_TEXT4, m_creature);//6
DoScriptText(SCRIPT_TEXT4, me);//6
CanWalk = false;
Event_Timer = 5000;
break;
@@ -238,7 +238,7 @@ struct npc_grimstoneAI : public npc_escortAI
if (RingBossGUID)
{
Creature *boss = Unit::GetCreature(*m_creature,RingBossGUID);
Creature *boss = Unit::GetCreature(*me,RingBossGUID);
if (boss && !boss->isAlive() && boss->isDead())
{
RingBossGUID = 0;
@@ -251,7 +251,7 @@ struct npc_grimstoneAI : public npc_escortAI
for (uint8 i = 0; i < MAX_MOB_AMOUNT; ++i)
{
Creature *mob = Unit::GetCreature(*m_creature,RingMobGUID[i]);
Creature *mob = Unit::GetCreature(*me,RingMobGUID[i]);
if (mob && !mob->isAlive() && mob->isDead())
{
RingMobGUID[i] = 0;
@@ -275,7 +275,7 @@ struct npc_grimstoneAI : public npc_escortAI
switch(EventPhase)
{
case 0:
DoScriptText(SCRIPT_TEXT5, m_creature);//1
DoScriptText(SCRIPT_TEXT5, me);//1
HandleGameObject(DATA_ARENA4, false);
Start(false, false);
CanWalk = true;
@@ -294,7 +294,7 @@ struct npc_grimstoneAI : public npc_escortAI
break;
case 4:
CanWalk = true;
m_creature->SetVisibility(VISIBILITY_OFF);
me->SetVisibility(VISIBILITY_OFF);
SummonRingMob();
Event_Timer = 8000;
break;
@@ -308,9 +308,9 @@ struct npc_grimstoneAI : public npc_escortAI
Event_Timer = 0;
break;
case 7:
m_creature->SetVisibility(VISIBILITY_ON);
me->SetVisibility(VISIBILITY_ON);
HandleGameObject(DATA_ARENA1, false);
DoScriptText(SCRIPT_TEXT6, m_creature);//4
DoScriptText(SCRIPT_TEXT6, me);//4
CanWalk = true;
Event_Timer = 0;
break;
@@ -319,7 +319,7 @@ struct npc_grimstoneAI : public npc_escortAI
Event_Timer = 5000;
break;
case 9:
m_creature->SetVisibility(VISIBILITY_OFF);
me->SetVisibility(VISIBILITY_OFF);
SummonRingBoss();
Event_Timer = 0;
break;
@@ -381,16 +381,16 @@ struct mob_phalanxAI : public ScriptedAI
//ThunderClap_Timer
if (ThunderClap_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_THUNDERCLAP);
DoCast(me->getVictim(), SPELL_THUNDERCLAP);
ThunderClap_Timer = 10000;
} else ThunderClap_Timer -= diff;
//FireballVolley_Timer
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 51)
if (me->GetHealth()*100 / me->GetMaxHealth() < 51)
{
if (FireballVolley_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FIREBALLVOLLEY);
DoCast(me->getVictim(), SPELL_FIREBALLVOLLEY);
FireballVolley_Timer = 15000;
} else FireballVolley_Timer -= diff;
}
@@ -398,7 +398,7 @@ struct mob_phalanxAI : public ScriptedAI
//MightyBlow_Timer
if (MightyBlow_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_MIGHTYBLOW);
DoCast(me->getVictim(), SPELL_MIGHTYBLOW);
MightyBlow_Timer = 10000;
} else MightyBlow_Timer -= diff;
@@ -579,12 +579,12 @@ struct npc_dughal_stormwingAI : public npc_escortAI
{
switch(i)
{
case 0:m_creature->Say(SAY_DUGHAL_FREE, LANG_UNIVERSAL, PlayerGUID); break;
case 0:me->Say(SAY_DUGHAL_FREE, LANG_UNIVERSAL, PlayerGUID); break;
case 1:pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break;
case 2:
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetVisibility(VISIBILITY_OFF);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED);
break;
}
@@ -595,11 +595,11 @@ struct npc_dughal_stormwingAI : public npc_escortAI
void JustDied(Unit* killer)
{
if (IsBeingEscorted && killer == m_creature)
if (IsBeingEscorted && killer == me)
{
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetVisibility(VISIBILITY_OFF);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
pInstance->SetData(DATA_DUGHAL,ENCOUNTER_STATE_ENDED);
}
}
@@ -609,15 +609,15 @@ struct npc_dughal_stormwingAI : public npc_escortAI
if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return;
if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_ENDED)
{
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetVisibility(VISIBILITY_OFF);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
else
{
m_creature->SetVisibility(VISIBILITY_ON);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetVisibility(VISIBILITY_ON);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
npc_escortAI::UpdateAI(diff);
}
@@ -683,41 +683,41 @@ struct npc_marshal_windsorAI : public npc_escortAI
switch(i)
{
case 1:
m_creature->Say(SAY_WINDSOR_1, LANG_UNIVERSAL, PlayerGUID);
me->Say(SAY_WINDSOR_1, LANG_UNIVERSAL, PlayerGUID);
break;
case 7:
m_creature->HandleEmoteCommand(EMOTE_STATE_POINT);
m_creature->Say(SAY_WINDSOR_4_1, LANG_UNIVERSAL, PlayerGUID);
me->HandleEmoteCommand(EMOTE_STATE_POINT);
me->Say(SAY_WINDSOR_4_1, LANG_UNIVERSAL, PlayerGUID);
IsOnHold=true;
break;
case 10:
m_creature->setFaction(534);
me->setFaction(534);
break;
case 12:
m_creature->Say(SAY_WINDSOR_6, LANG_UNIVERSAL, PlayerGUID);
me->Say(SAY_WINDSOR_6, LANG_UNIVERSAL, PlayerGUID);
pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_IN_PROGRESS);
break;
case 13:
m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK
me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK
break;
case 14:
pInstance->SetData(DATA_GATE_SR,0);
m_creature->setFaction(11);
me->setFaction(11);
break;
case 16:
m_creature->Say(SAY_WINDSOR_9, LANG_UNIVERSAL, PlayerGUID);
me->Say(SAY_WINDSOR_9, LANG_UNIVERSAL, PlayerGUID);
break;
case 17:
m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK
me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK
break;
case 18:
pInstance->SetData(DATA_GATE_SC,0);
break;
case 19:
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->SummonCreature(MOB_ENTRY_REGINALD_WINDSOR,403.61,-51.71,-63.92,3.600434,TEMPSUMMON_DEAD_DESPAWN ,0);
me->SetVisibility(VISIBILITY_OFF);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SummonCreature(MOB_ENTRY_REGINALD_WINDSOR,403.61,-51.71,-63.92,3.600434,TEMPSUMMON_DEAD_DESPAWN ,0);
pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_ENDED);
break;
}
@@ -727,9 +727,9 @@ struct npc_marshal_windsorAI : public npc_escortAI
{
switch (urand(0,2))
{
case 0: m_creature->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break;
case 1: m_creature->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break;
case 2: m_creature->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break;
case 0: me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break;
case 1: me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break;
case 2: me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break;
}
}
@@ -747,25 +747,25 @@ struct npc_marshal_windsorAI : public npc_escortAI
SetEscortPaused(false);
if (!pInstance->GetData(DATA_GATE_D) && pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_NOT_STARTED)
{
m_creature->Say(SAY_WINDSOR_4_2, LANG_UNIVERSAL, PlayerGUID);
me->Say(SAY_WINDSOR_4_2, LANG_UNIVERSAL, PlayerGUID);
pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_BEFORE_START);
}
if (pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED)
{
m_creature->Say(SAY_WINDSOR_4_3, LANG_UNIVERSAL, PlayerGUID);
me->Say(SAY_WINDSOR_4_3, LANG_UNIVERSAL, PlayerGUID);
pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED);
}
if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_SUPPLY_ROOM) == ENCOUNTER_STATE_ENDED)
{
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetVisibility(VISIBILITY_OFF);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
else
{
m_creature->SetVisibility(VISIBILITY_ON);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetVisibility(VISIBILITY_ON);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
npc_escortAI::UpdateAI(diff);
}
@@ -848,53 +848,53 @@ struct npc_marshal_reginald_windsorAI : public npc_escortAI
switch(i)
{
case 0:
m_creature->setFaction(11);
m_creature->Say(SAY_REGINALD_WINDSOR_0_1, LANG_UNIVERSAL, PlayerGUID);
me->setFaction(11);
me->Say(SAY_REGINALD_WINDSOR_0_1, LANG_UNIVERSAL, PlayerGUID);
break;
case 1:
m_creature->Say(SAY_REGINALD_WINDSOR_0_2, LANG_UNIVERSAL, PlayerGUID);
me->Say(SAY_REGINALD_WINDSOR_0_2, LANG_UNIVERSAL, PlayerGUID);
break;
case 7:
m_creature->HandleEmoteCommand(EMOTE_STATE_POINT);
m_creature->Say(SAY_REGINALD_WINDSOR_5_1, LANG_UNIVERSAL, PlayerGUID);
me->HandleEmoteCommand(EMOTE_STATE_POINT);
me->Say(SAY_REGINALD_WINDSOR_5_1, LANG_UNIVERSAL, PlayerGUID);
IsOnHold=true;
break;
case 8:
m_creature->Say(SAY_REGINALD_WINDSOR_5_2, LANG_UNIVERSAL, PlayerGUID);
me->Say(SAY_REGINALD_WINDSOR_5_2, LANG_UNIVERSAL, PlayerGUID);
break;
case 11:
m_creature->HandleEmoteCommand(EMOTE_STATE_POINT);
m_creature->Say(SAY_REGINALD_WINDSOR_7_1, LANG_UNIVERSAL, PlayerGUID);
me->HandleEmoteCommand(EMOTE_STATE_POINT);
me->Say(SAY_REGINALD_WINDSOR_7_1, LANG_UNIVERSAL, PlayerGUID);
IsOnHold=true;
break;
case 12:
m_creature->Say(SAY_REGINALD_WINDSOR_7_2, LANG_UNIVERSAL, PlayerGUID);
me->Say(SAY_REGINALD_WINDSOR_7_2, LANG_UNIVERSAL, PlayerGUID);
break;
case 13:
m_creature->Say(SAY_REGINALD_WINDSOR_7_3, LANG_UNIVERSAL, PlayerGUID);
me->Say(SAY_REGINALD_WINDSOR_7_3, LANG_UNIVERSAL, PlayerGUID);
break;
case 20:
m_creature->HandleEmoteCommand(EMOTE_STATE_POINT);
m_creature->Say(SAY_REGINALD_WINDSOR_13_1, LANG_UNIVERSAL, PlayerGUID);
me->HandleEmoteCommand(EMOTE_STATE_POINT);
me->Say(SAY_REGINALD_WINDSOR_13_1, LANG_UNIVERSAL, PlayerGUID);
IsOnHold=true;
break;
case 21:
m_creature->Say(SAY_REGINALD_WINDSOR_13_3, LANG_UNIVERSAL, PlayerGUID);
me->Say(SAY_REGINALD_WINDSOR_13_3, LANG_UNIVERSAL, PlayerGUID);
break;
case 23:
m_creature->HandleEmoteCommand(EMOTE_STATE_POINT);
m_creature->Say(SAY_REGINALD_WINDSOR_14_1, LANG_UNIVERSAL, PlayerGUID);
me->HandleEmoteCommand(EMOTE_STATE_POINT);
me->Say(SAY_REGINALD_WINDSOR_14_1, LANG_UNIVERSAL, PlayerGUID);
IsOnHold=true;
break;
case 24:
m_creature->Say(SAY_REGINALD_WINDSOR_14_2, LANG_UNIVERSAL, PlayerGUID);
me->Say(SAY_REGINALD_WINDSOR_14_2, LANG_UNIVERSAL, PlayerGUID);
break;
case 31:
m_creature->Say(SAY_REGINALD_WINDSOR_20_1, LANG_UNIVERSAL, PlayerGUID);
me->Say(SAY_REGINALD_WINDSOR_20_1, LANG_UNIVERSAL, PlayerGUID);
break;
case 32:
m_creature->Say(SAY_REGINALD_WINDSOR_20_2, LANG_UNIVERSAL, PlayerGUID);
PlayerStart->GroupEventHappens(QUEST_JAIL_BREAK, m_creature);
me->Say(SAY_REGINALD_WINDSOR_20_2, LANG_UNIVERSAL, PlayerGUID);
PlayerStart->GroupEventHappens(QUEST_JAIL_BREAK, me);
pInstance->SetData(DATA_SHILL, ENCOUNTER_STATE_ENDED);
break;
}
@@ -910,7 +910,7 @@ struct npc_marshal_reginald_windsorAI : public npc_escortAI
if (CAST_PLR(who)->GetQuestStatus(4322) == QUEST_STATUS_INCOMPLETE)
{
float Radius = 10.0;
if (m_creature->IsWithinDistInMap(who, Radius))
if (me->IsWithinDistInMap(who, Radius))
{
SetEscortPaused(false);
Start(true, false, who->GetGUID());
@@ -923,9 +923,9 @@ struct npc_marshal_reginald_windsorAI : public npc_escortAI
{
switch (urand(0,2))
{
case 0: m_creature->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break;
case 1: m_creature->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break;
case 2: m_creature->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break;
case 0: me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, PlayerGUID); break;
case 1: me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, PlayerGUID); break;
case 2: me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break;
}
}
void Reset() {}
@@ -969,7 +969,7 @@ struct npc_marshal_reginald_windsorAI : public npc_escortAI
if (!pInstance->GetData(DATA_GATE_C) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_NOT_STARTED)
{
pInstance->SetData(DATA_CREATURE_CREST,1);
m_creature->Say(SAY_REGINALD_WINDSOR_13_2, LANG_UNIVERSAL, PlayerGUID);
me->Say(SAY_REGINALD_WINDSOR_13_2, LANG_UNIVERSAL, PlayerGUID);
pInstance->SetData(DATA_CREST,ENCOUNTER_STATE_IN_PROGRESS);
}
if (pInstance->GetData(DATA_CREATURE_CREST) && pInstance->GetData(DATA_CREST) == ENCOUNTER_STATE_IN_PROGRESS)
@@ -1040,11 +1040,11 @@ struct npc_tobias_seecherAI : public npc_escortAI
void JustDied(Unit* killer)
{
if (IsBeingEscorted && killer == m_creature)
if (IsBeingEscorted && killer == me)
{
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetVisibility(VISIBILITY_OFF);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED);
}
}
@@ -1053,13 +1053,13 @@ struct npc_tobias_seecherAI : public npc_escortAI
{
switch(i)
{
case 0:m_creature->Say(SAY_TOBIAS_FREE, LANG_UNIVERSAL, PlayerGUID); break;
case 0:me->Say(SAY_TOBIAS_FREE, LANG_UNIVERSAL, PlayerGUID); break;
case 2:
pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_OBJECTIVE_COMPLETED);break;
case 4:
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetVisibility(VISIBILITY_OFF);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
pInstance->SetData(DATA_TOBIAS,ENCOUNTER_STATE_ENDED);
break;
}
@@ -1070,15 +1070,15 @@ struct npc_tobias_seecherAI : public npc_escortAI
if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) return;
if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED)&& pInstance->GetData(DATA_TOBIAS) == ENCOUNTER_STATE_ENDED)
{
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetVisibility(VISIBILITY_OFF);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
else
{
m_creature->SetVisibility(VISIBILITY_ON);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetVisibility(VISIBILITY_ON);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
npc_escortAI::UpdateAI(diff);
}
@@ -1174,19 +1174,19 @@ struct npc_rocknotAI : public npc_escortAI
switch(i)
{
case 1:
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_KICK);
me->HandleEmoteCommand(EMOTE_ONESHOT_KICK);
break;
case 2:
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED);
me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED);
break;
case 3:
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED);
me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACKUNARMED);
break;
case 4:
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_KICK);
me->HandleEmoteCommand(EMOTE_ONESHOT_KICK);
break;
case 5:
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_KICK);
me->HandleEmoteCommand(EMOTE_ONESHOT_KICK);
BreakKeg_Timer = 2000;
break;
}
@@ -1215,7 +1215,7 @@ struct npc_rocknotAI : public npc_escortAI
DoGo(DATA_GO_BAR_KEG_TRAP,0); //doesn't work very well, leaving code here for future
//spell by trap has effect61, this indicate the bar go hostile
if (Unit *tmp = Unit::GetUnit(*m_creature,pInstance->GetData64(DATA_PHALANX)))
if (Unit *tmp = Unit::GetUnit(*me,pInstance->GetData64(DATA_PHALANX)))
tmp->setFaction(14);
//for later, this event(s) has alot more to it.
@@ -58,17 +58,17 @@ struct boss_ambassador_flamelashAI : public ScriptedAI
//FireBlast_Timer
if (FireBlast_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FIREBLAST);
DoCast(me->getVictim(), SPELL_FIREBLAST);
FireBlast_Timer = 7000;
} else FireBlast_Timer -= diff;
//Spirit_Timer
if (Spirit_Timer <= diff)
{
SummonSpirits(m_creature->getVictim());
SummonSpirits(m_creature->getVictim());
SummonSpirits(m_creature->getVictim());
SummonSpirits(m_creature->getVictim());
SummonSpirits(me->getVictim());
SummonSpirits(me->getVictim());
SummonSpirits(me->getVictim());
SummonSpirits(me->getVictim());
Spirit_Timer = 30000;
} else Spirit_Timer -= diff;
@@ -64,7 +64,7 @@ struct boss_anubshiahAI : public ScriptedAI
//ShadowBolt_Timer
if (ShadowBolt_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHADOWBOLT);
DoCast(me->getVictim(), SPELL_SHADOWBOLT);
ShadowBolt_Timer = 7000;
} else ShadowBolt_Timer -= diff;
@@ -79,14 +79,14 @@ struct boss_anubshiahAI : public ScriptedAI
//CurseOfWeakness_Timer
if (CurseOfWeakness_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CURSEOFWEAKNESS);
DoCast(me->getVictim(), SPELL_CURSEOFWEAKNESS);
CurseOfWeakness_Timer = 45000;
} else CurseOfWeakness_Timer -= diff;
//DemonArmor_Timer
if (DemonArmor_Timer <= diff)
{
DoCast(m_creature, SPELL_DEMONARMOR);
DoCast(me, SPELL_DEMONARMOR);
DemonArmor_Timer = 300000;
} else DemonArmor_Timer -= diff;
@@ -52,13 +52,13 @@ struct boss_draganthaurissanAI : public ScriptedAI
void EnterCombat(Unit *who)
{
DoScriptText(SAY_AGGRO, m_creature);
m_creature->CallForHelp(VISIBLE_RANGE);
DoScriptText(SAY_AGGRO, me);
me->CallForHelp(VISIBLE_RANGE);
}
void KilledUnit(Unit* victim)
{
DoScriptText(SAY_SLAY, m_creature);
DoScriptText(SAY_SLAY, me);
}
void UpdateAI(const uint32 diff)
@@ -88,7 +88,7 @@ struct boss_draganthaurissanAI : public ScriptedAI
//AvatarOfFlame_Timer
if (AvatarOfFlame_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_AVATAROFFLAME);
DoCast(me->getVictim(), SPELL_AVATAROFFLAME);
AvatarOfFlame_Timer = 18000;
} else AvatarOfFlame_Timer -= diff;
@@ -74,43 +74,43 @@ struct boss_general_angerforgeAI : public ScriptedAI
//MightyBlow_Timer
if (MightyBlow_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_MIGHTYBLOW);
DoCast(me->getVictim(), SPELL_MIGHTYBLOW);
MightyBlow_Timer = 18000;
} else MightyBlow_Timer -= diff;
//HamString_Timer
if (HamString_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_HAMSTRING);
DoCast(me->getVictim(), SPELL_HAMSTRING);
HamString_Timer = 15000;
} else HamString_Timer -= diff;
//Cleave_Timer
if (Cleave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 9000;
} else Cleave_Timer -= diff;
//Adds_Timer
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 21)
if (me->GetHealth()*100 / me->GetMaxHealth() < 21)
{
if (Adds_Timer <= diff)
{
// summon 3 Adds every 25s
SummonAdds(m_creature->getVictim());
SummonAdds(m_creature->getVictim());
SummonAdds(m_creature->getVictim());
SummonAdds(me->getVictim());
SummonAdds(me->getVictim());
SummonAdds(me->getVictim());
Adds_Timer = 25000;
} else Adds_Timer -= diff;
}
//Summon Medics
if (!Medics && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 21)
if (!Medics && me->GetHealth()*100 / me->GetMaxHealth() < 21)
{
SummonMedics(m_creature->getVictim());
SummonMedics(m_creature->getVictim());
SummonMedics(me->getVictim());
SummonMedics(me->getVictim());
Medics = true;
}
@@ -55,14 +55,14 @@ struct boss_gorosh_the_dervishAI : public ScriptedAI
//WhirlWind_Timer
if (WhirlWind_Timer <= diff)
{
DoCast(m_creature, SPELL_WHIRLWIND);
DoCast(me, SPELL_WHIRLWIND);
WhirlWind_Timer = 15000;
} else WhirlWind_Timer -= diff;
//MortalStrike_Timer
if (MortalStrike_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_MORTALSTRIKE);
DoCast(me->getVictim(), SPELL_MORTALSTRIKE);
MortalStrike_Timer = 15000;
} else MortalStrike_Timer -= diff;
@@ -60,17 +60,17 @@ struct boss_grizzleAI : public ScriptedAI
//GroundTremor_Timer
if (GroundTremor_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_GROUNDTREMOR);
DoCast(me->getVictim(), SPELL_GROUNDTREMOR);
GroundTremor_Timer = 8000;
} else GroundTremor_Timer -= diff;
//Frenzy_Timer
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 51)
if (me->GetHealth()*100 / me->GetMaxHealth() < 51)
{
if (Frenzy_Timer <= diff)
{
DoCast(m_creature, SPELL_FRENZY);
DoScriptText(EMOTE_GENERIC_FRENZY_KILL, m_creature);
DoCast(me, SPELL_FRENZY);
DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me);
Frenzy_Timer = 15000;
} else Frenzy_Timer -= diff;
@@ -77,14 +77,14 @@ struct boss_high_interrogator_gerstahnAI : public ScriptedAI
//PsychicScream_Timer
if (PsychicScream_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_PSYCHICSCREAM);
DoCast(me->getVictim(), SPELL_PSYCHICSCREAM);
PsychicScream_Timer = 30000;
} else PsychicScream_Timer -= diff;
//ShadowShield_Timer
if (ShadowShield_Timer <= diff)
{
DoCast(m_creature, SPELL_SHADOWSHIELD);
DoCast(me, SPELL_SHADOWSHIELD);
ShadowShield_Timer = 25000;
} else ShadowShield_Timer -= diff;
@@ -60,16 +60,16 @@ struct boss_magmusAI : public ScriptedAI
//FieryBurst_Timer
if (FieryBurst_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FIERYBURST);
DoCast(me->getVictim(), SPELL_FIERYBURST);
FieryBurst_Timer = 6000;
} else FieryBurst_Timer -= diff;
//WarStomp_Timer
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 51)
if (me->GetHealth()*100 / me->GetMaxHealth() < 51)
{
if (WarStomp_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WARSTOMP);
DoCast(me->getVictim(), SPELL_WARSTOMP);
WarStomp_Timer = 8000;
} else WarStomp_Timer -= diff;
}
@@ -63,21 +63,21 @@ struct boss_moira_bronzebeardAI : public ScriptedAI
//MindBlast_Timer
if (MindBlast_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_MINDBLAST);
DoCast(me->getVictim(), SPELL_MINDBLAST);
MindBlast_Timer = 14000;
} else MindBlast_Timer -= diff;
//ShadowWordPain_Timer
if (ShadowWordPain_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHADOWWORDPAIN);
DoCast(me->getVictim(), SPELL_SHADOWWORDPAIN);
ShadowWordPain_Timer = 18000;
} else ShadowWordPain_Timer -= diff;
//Smite_Timer
if (Smite_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SMITE);
DoCast(me->getVictim(), SPELL_SMITE);
Smite_Timer = 10000;
} else Smite_Timer -= diff;
@@ -116,16 +116,16 @@ struct boss_doomrelAI : public ScriptedAI
DemonArmor_Timer = 16000;
Voidwalkers = false;
m_creature->setFaction(FACTION_FRIEND);
me->setFaction(FACTION_FRIEND);
// was set before event start, so set again
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
if (pInstance)
if (pInstance->GetData(DATA_GHOSTKILL) >= 7)
m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
else
m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
void EnterCombat(Unit *who)
@@ -134,13 +134,13 @@ struct boss_doomrelAI : public ScriptedAI
void EnterEvadeMode()
{
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
m_creature->CombatStop(true);
m_creature->LoadCreaturesAddon();
if (m_creature->isAlive())
m_creature->GetMotionMaster()->MoveTargetedHome();
m_creature->SetLootRecipient(NULL);
me->RemoveAllAuras();
me->DeleteThreatList();
me->CombatStop(true);
me->LoadCreaturesAddon();
if (me->isAlive())
me->GetMotionMaster()->MoveTargetedHome();
me->SetLootRecipient(NULL);
if (pInstance)
pInstance->SetData64(DATA_EVENSTARTER, 0);
}
@@ -159,7 +159,7 @@ struct boss_doomrelAI : public ScriptedAI
//ShadowVolley_Timer
if (ShadowVolley_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHADOWBOLTVOLLEY);
DoCast(me->getVictim(), SPELL_SHADOWBOLTVOLLEY);
ShadowVolley_Timer = 12000;
} else ShadowVolley_Timer -= diff;
@@ -175,21 +175,21 @@ struct boss_doomrelAI : public ScriptedAI
//CurseOfWeakness_Timer
if (CurseOfWeakness_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CURSEOFWEAKNESS);
DoCast(me->getVictim(), SPELL_CURSEOFWEAKNESS);
CurseOfWeakness_Timer = 45000;
} else CurseOfWeakness_Timer -= diff;
//DemonArmor_Timer
if (DemonArmor_Timer <= diff)
{
DoCast(m_creature, SPELL_DEMONARMOR);
DoCast(me, SPELL_DEMONARMOR);
DemonArmor_Timer = 300000;
} else DemonArmor_Timer -= diff;
//Summon Voidwalkers
if (!Voidwalkers && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 51)
if (!Voidwalkers && me->GetHealth()*100 / me->GetMaxHealth() < 51)
{
DoCast(m_creature->getVictim(), SPELL_SUMMON_VOIDWALKERS, true);
DoCast(me->getVictim(), SPELL_SUMMON_VOIDWALKERS, true);
Voidwalkers = true;
}
@@ -58,28 +58,28 @@ struct boss_drakkisathAI : public ScriptedAI
//FireNova_Timer
if (FireNova_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FIRENOVA);
DoCast(me->getVictim(), SPELL_FIRENOVA);
FireNova_Timer = 10000;
} else FireNova_Timer -= diff;
//Cleave_Timer
if (Cleave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 8000;
} else Cleave_Timer -= diff;
//Confliguration_Timer
if (Confliguration_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CONFLIGURATION);
DoCast(me->getVictim(), SPELL_CONFLIGURATION);
Confliguration_Timer = 18000;
} else Confliguration_Timer -= diff;
//Thunderclap_Timer
if (Thunderclap_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_THUNDERCLAP);
DoCast(me->getVictim(), SPELL_THUNDERCLAP);
Thunderclap_Timer = 20000;
} else Thunderclap_Timer -= diff;
@@ -71,8 +71,8 @@ struct boss_gythAI : public ScriptedAI
Line2Count = 2;
//Invisible for event start
m_creature->SetDisplayId(11686);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetDisplayId(11686);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
void EnterCombat(Unit *who)
@@ -81,7 +81,7 @@ struct boss_gythAI : public ScriptedAI
void SummonCreatureWithRandomTarget(uint32 creatureId)
{
Unit* Summoned = m_creature->SummonCreature(creatureId, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 240000);
Unit* Summoned = me->SummonCreature(creatureId, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 240000);
if (Summoned)
{
Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
@@ -100,8 +100,8 @@ struct boss_gythAI : public ScriptedAI
if (!RootSelf)
{
//m_creature->m_canMove = true;
DoCast(m_creature, 33356);
//me->m_canMove = true;
DoCast(me, 33356);
RootSelf = true;
}
@@ -111,9 +111,9 @@ struct boss_gythAI : public ScriptedAI
{
bAggro = true;
// Visible now!
m_creature->SetDisplayId(9723);
m_creature->setFaction(14);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetDisplayId(9723);
me->setFaction(14);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
} else Aggro_Timer -= diff;
}
@@ -153,34 +153,34 @@ struct boss_gythAI : public ScriptedAI
// CorrosiveAcid_Timer
if (CorrosiveAcid_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CORROSIVEACID);
DoCast(me->getVictim(), SPELL_CORROSIVEACID);
CorrosiveAcid_Timer = 7000;
} else CorrosiveAcid_Timer -= diff;
// Freeze_Timer
if (Freeze_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FREEZE);
DoCast(me->getVictim(), SPELL_FREEZE);
Freeze_Timer = 16000;
} else Freeze_Timer -= diff;
// Flamebreath_Timer
if (Flamebreath_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FLAMEBREATH);
DoCast(me->getVictim(), SPELL_FLAMEBREATH);
Flamebreath_Timer = 10500;
} else Flamebreath_Timer -= diff;
//Summon Rend
if (!SummonedRend && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 11
&& m_creature->GetHealth() > 0)
if (!SummonedRend && me->GetHealth()*100 / me->GetMaxHealth() < 11
&& me->GetHealth() > 0)
{
//summon Rend and Change model to normal Gyth
//Inturrupt any spell casting
m_creature->InterruptNonMeleeSpells(false);
me->InterruptNonMeleeSpells(false);
//Gyth model
m_creature->SetDisplayId(9806);
m_creature->SummonCreature(10429, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000);
me->SetDisplayId(9806);
me->SummonCreature(10429, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 900000);
SummonedRend = true;
}
@@ -59,21 +59,21 @@ struct boss_halyconAI : public ScriptedAI
//CrowdPummel_Timer
if (CrowdPummel_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CROWDPUMMEL);
DoCast(me->getVictim(), SPELL_CROWDPUMMEL);
CrowdPummel_Timer = 14000;
} else CrowdPummel_Timer -= diff;
//MightyBlow_Timer
if (MightyBlow_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_MIGHTYBLOW);
DoCast(me->getVictim(), SPELL_MIGHTYBLOW);
MightyBlow_Timer = 10000;
} else MightyBlow_Timer -= diff;
//Summon Gizrul
if (!Summoned && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 25)
if (!Summoned && me->GetHealth()*100 / me->GetMaxHealth() < 25)
{
m_creature->SummonCreature(10268,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000);
me->SummonCreature(10268,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000);
Summoned = true;
}
@@ -67,49 +67,49 @@ struct boss_highlordomokkAI : public ScriptedAI
//WarStomp_Timer
if (WarStomp_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WARSTOMP);
DoCast(me->getVictim(), SPELL_WARSTOMP);
WarStomp_Timer = 14000;
} else WarStomp_Timer -= diff;
//Cleave_Timer
if (Cleave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 8000;
} else Cleave_Timer -= diff;
//Strike_Timer
if (Strike_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_STRIKE);
DoCast(me->getVictim(), SPELL_STRIKE);
Strike_Timer = 10000;
} else Strike_Timer -= diff;
//Rend_Timer
if (Rend_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_REND);
DoCast(me->getVictim(), SPELL_REND);
Rend_Timer = 18000;
} else Rend_Timer -= diff;
//SunderArmor_Timer
if (SunderArmor_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SUNDERARMOR);
DoCast(me->getVictim(), SPELL_SUNDERARMOR);
SunderArmor_Timer = 25000;
} else SunderArmor_Timer -= diff;
//KnockAway_Timer
if (KnockAway_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_KNOCKAWAY);
DoCast(me->getVictim(), SPELL_KNOCKAWAY);
KnockAway_Timer = 12000;
} else KnockAway_Timer -= diff;
//Slow_Timer
if (Slow_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SLOW);
DoCast(me->getVictim(), SPELL_SLOW);
Slow_Timer = 18000;
} else Slow_Timer -= diff;
@@ -44,8 +44,8 @@ struct boss_mothersmolderwebAI : public ScriptedAI
void DamageTaken(Unit *done_by, uint32 &damage)
{
if (m_creature->GetHealth() <= damage)
DoCast(m_creature, SPELL_SUMMON_SPIRE_SPIDERLING, true);
if (me->GetHealth() <= damage)
DoCast(me, SPELL_SUMMON_SPIRE_SPIDERLING, true);
}
void UpdateAI(const uint32 diff)
@@ -57,14 +57,14 @@ struct boss_mothersmolderwebAI : public ScriptedAI
//Crystalize_Timer
if (Crystalize_Timer <= diff)
{
DoCast(m_creature, SPELL_CRYSTALIZE);
DoCast(me, SPELL_CRYSTALIZE);
Crystalize_Timer = 15000;
} else Crystalize_Timer -= diff;
//MothersMilk_Timer
if (MothersMilk_Timer <= diff)
{
DoCast(m_creature, SPELL_MOTHERSMILK);
DoCast(me, SPELL_MOTHERSMILK);
MothersMilk_Timer = urand(5000,12500);
} else MothersMilk_Timer -= diff;
@@ -70,39 +70,39 @@ struct boss_overlordwyrmthalakAI : public ScriptedAI
//BlastWave_Timer
if (BlastWave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_BLASTWAVE);
DoCast(me->getVictim(), SPELL_BLASTWAVE);
BlastWave_Timer = 20000;
} else BlastWave_Timer -= diff;
//Shout_Timer
if (Shout_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHOUT);
DoCast(me->getVictim(), SPELL_SHOUT);
Shout_Timer = 10000;
} else Shout_Timer -= diff;
//Cleave_Timer
if (Cleave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 7000;
} else Cleave_Timer -= diff;
//Knockaway_Timer
if (Knockaway_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_KNOCKAWAY);
DoCast(me->getVictim(), SPELL_KNOCKAWAY);
Knockaway_Timer = 14000;
} else Knockaway_Timer -= diff;
//Summon two Beserks
if (!Summoned && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 51)
if (!Summoned && me->GetHealth()*100 / me->GetMaxHealth() < 51)
{
Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0, 100, true);
if (Creature *SummonedCreature = m_creature->SummonCreature(9216,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000))
if (Creature *SummonedCreature = me->SummonCreature(9216,ADD_1X,ADD_1Y,ADD_1Z,ADD_1O,TEMPSUMMON_TIMED_DESPAWN,300000))
SummonedCreature->AI()->AttackStart(pTarget);
if (Creature *SummonedCreature = m_creature->SummonCreature(9268,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,300000))
if (Creature *SummonedCreature = me->SummonCreature(9268,ADD_2X,ADD_2Y,ADD_2Z,ADD_2O,TEMPSUMMON_TIMED_DESPAWN,300000))
SummonedCreature->AI()->AttackStart(pTarget);
Summoned = true;
}
@@ -55,14 +55,14 @@ struct boss_pyroguard_emberseerAI : public ScriptedAI
//FireNova_Timer
if (FireNova_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FIRENOVA);
DoCast(me->getVictim(), SPELL_FIRENOVA);
FireNova_Timer = 6000;
} else FireNova_Timer -= diff;
//FlameBuffet_Timer
if (FlameBuffet_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FLAMEBUFFET);
DoCast(me->getVictim(), SPELL_FLAMEBUFFET);
FlameBuffet_Timer = 14000;
} else FlameBuffet_Timer -= diff;
@@ -56,14 +56,14 @@ struct boss_quatermasterzigrisAI : public ScriptedAI
//Shoot_Timer
if (Shoot_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHOOT);
DoCast(me->getVictim(), SPELL_SHOOT);
Shoot_Timer = 500;
} else Shoot_Timer -= diff;
//StunBomb_Timer
if (StunBomb_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_STUNBOMB);
DoCast(me->getVictim(), SPELL_STUNBOMB);
StunBomb_Timer = 14000;
} else StunBomb_Timer -= diff;
@@ -55,21 +55,21 @@ struct boss_rend_blackhandAI : public ScriptedAI
//WhirlWind_Timer
if (WhirlWind_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WHIRLWIND);
DoCast(me->getVictim(), SPELL_WHIRLWIND);
WhirlWind_Timer = 18000;
} else WhirlWind_Timer -= diff;
//Cleave_Timer
if (Cleave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 10000;
} else Cleave_Timer -= diff;
//Thunderclap_Timer
if (Thunderclap_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_THUNDERCLAP);
DoCast(me->getVictim(), SPELL_THUNDERCLAP);
Thunderclap_Timer = 16000;
} else Thunderclap_Timer -= diff;
@@ -41,7 +41,7 @@ struct boss_shadowvoshAI : public ScriptedAI
Hex_Timer = 8000;
Cleave_Timer = 14000;
//DoCast(m_creature, SPELL_ICEARMOR, true);
//DoCast(me, SPELL_ICEARMOR, true);
}
void EnterCombat(Unit *who){}
@@ -55,7 +55,7 @@ struct boss_shadowvoshAI : public ScriptedAI
//CurseOfBlood_Timer
if (CurseOfBlood_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CURSEOFBLOOD);
DoCast(me->getVictim(), SPELL_CURSEOFBLOOD);
CurseOfBlood_Timer = 45000;
} else CurseOfBlood_Timer -= diff;
@@ -70,7 +70,7 @@ struct boss_shadowvoshAI : public ScriptedAI
//Cleave_Timer
if (Cleave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 7000;
} else Cleave_Timer -= diff;
@@ -55,7 +55,7 @@ struct boss_thebeastAI : public ScriptedAI
//Flamebreak_Timer
if (Flamebreak_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FLAMEBREAK);
DoCast(me->getVictim(), SPELL_FLAMEBREAK);
Flamebreak_Timer = 10000;
} else Flamebreak_Timer -= diff;
@@ -70,7 +70,7 @@ struct boss_thebeastAI : public ScriptedAI
//TerrifyingRoar_Timer
if (TerrifyingRoar_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_TERRIFYINGROAR);
DoCast(me->getVictim(), SPELL_TERRIFYINGROAR);
TerrifyingRoar_Timer = 20000;
} else TerrifyingRoar_Timer -= diff;
@@ -64,42 +64,42 @@ struct boss_warmastervooneAI : public ScriptedAI
//Snapkick_Timer
if (Snapkick_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SNAPKICK);
DoCast(me->getVictim(), SPELL_SNAPKICK);
Snapkick_Timer = 6000;
} else Snapkick_Timer -= diff;
//Cleave_Timer
if (Cleave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 12000;
} else Cleave_Timer -= diff;
//Uppercut_Timer
if (Uppercut_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_UPPERCUT);
DoCast(me->getVictim(), SPELL_UPPERCUT);
Uppercut_Timer = 14000;
} else Uppercut_Timer -= diff;
//MortalStrike_Timer
if (MortalStrike_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_MORTALSTRIKE);
DoCast(me->getVictim(), SPELL_MORTALSTRIKE);
MortalStrike_Timer = 10000;
} else MortalStrike_Timer -= diff;
//Pummel_Timer
if (Pummel_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_PUMMEL);
DoCast(me->getVictim(), SPELL_PUMMEL);
Pummel_Timer = 16000;
} else Pummel_Timer -= diff;
//ThrowAxe_Timer
if (ThrowAxe_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_THROWAXE);
DoCast(me->getVictim(), SPELL_THROWAXE);
ThrowAxe_Timer = 8000;
} else ThrowAxe_Timer -= diff;
@@ -50,7 +50,7 @@ struct boss_broodlordAI : public ScriptedAI
void EnterCombat(Unit *who)
{
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
DoZoneInCombat();
}
@@ -62,36 +62,36 @@ struct boss_broodlordAI : public ScriptedAI
//Cleave_Timer
if (Cleave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 7000;
} else Cleave_Timer -= diff;
// BlastWave
if (BlastWave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_BLASTWAVE);
DoCast(me->getVictim(), SPELL_BLASTWAVE);
BlastWave_Timer = urand(8000,16000);
} else BlastWave_Timer -= diff;
//MortalStrike_Timer
if (MortalStrike_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_MORTALSTRIKE);
DoCast(me->getVictim(), SPELL_MORTALSTRIKE);
MortalStrike_Timer = urand(25000,35000);
} else MortalStrike_Timer -= diff;
if (KnockBack_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_KNOCKBACK);
DoCast(me->getVictim(), SPELL_KNOCKBACK);
//Drop 50% aggro
if (DoGetThreat(m_creature->getVictim()))
DoModifyThreatPercent(m_creature->getVictim(),-50);
if (DoGetThreat(me->getVictim()))
DoModifyThreatPercent(me->getVictim(),-50);
KnockBack_Timer = urand(15000,30000);
} else KnockBack_Timer -= diff;
if (EnterEvadeIfOutOfCombatArea(diff))
DoScriptText(SAY_LEASH, m_creature);
DoScriptText(SAY_LEASH, me);
DoMeleeAttackIfReady();
}
@@ -199,43 +199,43 @@ struct boss_chromaggusAI : public ScriptedAI
{
//Remove old vulnerabilty spell
if (CurrentVurln_Spell)
m_creature->RemoveAurasDueToSpell(CurrentVurln_Spell);
me->RemoveAurasDueToSpell(CurrentVurln_Spell);
//Cast new random vulnerabilty on self
uint32 spell = RAND(SPELL_FIRE_VULNERABILITY, SPELL_FROST_VULNERABILITY,
SPELL_SHADOW_VULNERABILITY, SPELL_NATURE_VULNERABILITY, SPELL_ARCANE_VULNERABILITY);
DoCast(m_creature, spell);
DoCast(me, spell);
CurrentVurln_Spell = spell;
DoScriptText(EMOTE_SHIMMER, m_creature);
DoScriptText(EMOTE_SHIMMER, me);
Shimmer_Timer = 45000;
} else Shimmer_Timer -= diff;
//Breath1_Timer
if (Breath1_Timer <= diff)
{
DoCast(m_creature->getVictim(), Breath1_Spell);
DoCast(me->getVictim(), Breath1_Spell);
Breath1_Timer = 60000;
} else Breath1_Timer -= diff;
//Breath2_Timer
if (Breath2_Timer <= diff)
{
DoCast(m_creature->getVictim(), Breath2_Spell);
DoCast(me->getVictim(), Breath2_Spell);
Breath2_Timer = 60000;
} else Breath2_Timer -= diff;
//Affliction_Timer
if (Affliction_Timer <= diff)
{
std::list<HostileReference*> threatlist = m_creature->getThreatManager().getThreatList();
std::list<HostileReference*> threatlist = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* pUnit;
if ((*i) && (*i)->getSource())
{
pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit)
{
//Cast affliction
@@ -270,15 +270,15 @@ struct boss_chromaggusAI : public ScriptedAI
//Frenzy_Timer
if (Frenzy_Timer <= diff)
{
DoCast(m_creature, SPELL_FRENZY);
DoScriptText(EMOTE_FRENZY, m_creature);
DoCast(me, SPELL_FRENZY);
DoScriptText(EMOTE_FRENZY, me);
Frenzy_Timer = urand(10000,15000);
} else Frenzy_Timer -= diff;
//Enrage if not already enraged and below 20%
if (!Enraged && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 20)
if (!Enraged && (me->GetHealth()*100 / me->GetMaxHealth()) < 20)
{
DoCast(m_creature, SPELL_ENRAGE);
DoCast(me, SPELL_ENRAGE);
Enraged = true;
}
@@ -58,29 +58,29 @@ struct boss_ebonrocAI : public ScriptedAI
//Shadowflame Timer
if (ShadowFlame_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHADOWFLAME);
DoCast(me->getVictim(), SPELL_SHADOWFLAME);
ShadowFlame_Timer = urand(12000,15000);
} else ShadowFlame_Timer -= diff;
//Wing Buffet Timer
if (WingBuffet_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WINGBUFFET);
DoCast(me->getVictim(), SPELL_WINGBUFFET);
WingBuffet_Timer = 25000;
} else WingBuffet_Timer -= diff;
//Shadow of Ebonroc Timer
if (ShadowOfEbonroc_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHADOWOFEBONROC);
DoCast(me->getVictim(), SPELL_SHADOWOFEBONROC);
ShadowOfEbonroc_Timer = urand(25000,350000);
} else ShadowOfEbonroc_Timer -= diff;
if (m_creature->getVictim()->HasAura(SPELL_SHADOWOFEBONROC))
if (me->getVictim()->HasAura(SPELL_SHADOWOFEBONROC))
{
if (Heal_Timer <= diff)
{
DoCast(m_creature, SPELL_HEAL);
DoCast(me, SPELL_HEAL);
Heal_Timer = urand(1000,3000);
} else Heal_Timer -= diff;
}
@@ -55,16 +55,16 @@ struct boss_firemawAI : public ScriptedAI
//ShadowFlame_Timer
if (ShadowFlame_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHADOWFLAME);
DoCast(me->getVictim(), SPELL_SHADOWFLAME);
ShadowFlame_Timer = urand(15000,18000);
} else ShadowFlame_Timer -= diff;
//WingBuffet_Timer
if (WingBuffet_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WINGBUFFET);
if (DoGetThreat(m_creature->getVictim()))
DoModifyThreatPercent(m_creature->getVictim(),-75);
DoCast(me->getVictim(), SPELL_WINGBUFFET);
if (DoGetThreat(me->getVictim()))
DoModifyThreatPercent(me->getVictim(),-75);
WingBuffet_Timer = 25000;
} else WingBuffet_Timer -= diff;
@@ -72,7 +72,7 @@ struct boss_firemawAI : public ScriptedAI
//FlameBuffet_Timer
if (FlameBuffet_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FLAMEBUFFET);
DoCast(me->getVictim(), SPELL_FLAMEBUFFET);
FlameBuffet_Timer = 5000;
} else FlameBuffet_Timer -= diff;
@@ -57,16 +57,16 @@ struct boss_flamegorAI : public ScriptedAI
//ShadowFlame_Timer
if (ShadowFlame_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHADOWFLAME);
DoCast(me->getVictim(), SPELL_SHADOWFLAME);
ShadowFlame_Timer = 15000 + rand()%7000;
} else ShadowFlame_Timer -= diff;
//WingBuffet_Timer
if (WingBuffet_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WINGBUFFET);
if (DoGetThreat(m_creature->getVictim()))
DoModifyThreatPercent(m_creature->getVictim(),-75);
DoCast(me->getVictim(), SPELL_WINGBUFFET);
if (DoGetThreat(me->getVictim()))
DoModifyThreatPercent(me->getVictim(),-75);
WingBuffet_Timer = 25000;
} else WingBuffet_Timer -= diff;
@@ -74,8 +74,8 @@ struct boss_flamegorAI : public ScriptedAI
//Frenzy_Timer
if (Frenzy_Timer <= diff)
{
DoScriptText(EMOTE_FRENZY, m_creature);
DoCast(m_creature, SPELL_FRENZY);
DoScriptText(EMOTE_FRENZY, me);
DoCast(me, SPELL_FRENZY);
Frenzy_Timer = urand(8000, 10000);
} else Frenzy_Timer -= diff;
@@ -90,17 +90,17 @@ struct boss_nefarianAI : public ScriptedAI
if (rand()%5)
return;
DoScriptText(SAY_SLAY, m_creature, Victim);
DoScriptText(SAY_SLAY, me, Victim);
}
void JustDied(Unit* Killer)
{
DoScriptText(SAY_DEATH, m_creature);
DoScriptText(SAY_DEATH, me);
}
void EnterCombat(Unit *who)
{
DoScriptText(RAND(SAY_XHEALTH,SAY_AGGRO,SAY_SHADOWFLAME), m_creature);
DoScriptText(RAND(SAY_XHEALTH,SAY_AGGRO,SAY_SHADOWFLAME), me);
DoCast(who, SPELL_SHADOWFLAME_INITIAL);
DoZoneInCombat();
@@ -111,7 +111,7 @@ struct boss_nefarianAI : public ScriptedAI
if (DespawnTimer <= diff)
{
if (!UpdateVictim())
m_creature->ForcedDespawn();
me->ForcedDespawn();
DespawnTimer = 5000;
} else DespawnTimer -= diff;
@@ -121,28 +121,28 @@ struct boss_nefarianAI : public ScriptedAI
//ShadowFlame_Timer
if (ShadowFlame_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHADOWFLAME);
DoCast(me->getVictim(), SPELL_SHADOWFLAME);
ShadowFlame_Timer = 12000;
} else ShadowFlame_Timer -= diff;
//BellowingRoar_Timer
if (BellowingRoar_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_BELLOWINGROAR);
DoCast(me->getVictim(), SPELL_BELLOWINGROAR);
BellowingRoar_Timer = 30000;
} else BellowingRoar_Timer -= diff;
//VeilOfShadow_Timer
if (VeilOfShadow_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_VEILOFSHADOW);
DoCast(me->getVictim(), SPELL_VEILOFSHADOW);
VeilOfShadow_Timer = 15000;
} else VeilOfShadow_Timer -= diff;
//Cleave_Timer
if (Cleave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 7000;
} else Cleave_Timer -= diff;
@@ -150,7 +150,7 @@ struct boss_nefarianAI : public ScriptedAI
if (TailLash_Timer <= diff)
{
//Cast NYI since we need a better check for behind target
//DoCast(m_creature->getVictim(), SPELL_TAILLASH);
//DoCast(me->getVictim(), SPELL_TAILLASH);
TailLash_Timer = 10000;
} else TailLash_Timer -= diff;
@@ -165,40 +165,40 @@ struct boss_nefarianAI : public ScriptedAI
switch (urand(0,8))
{
case 0:
DoScriptText(SAY_MAGE, m_creature);
DoCast(m_creature, SPELL_MAGE);
DoScriptText(SAY_MAGE, me);
DoCast(me, SPELL_MAGE);
break;
case 1:
DoScriptText(SAY_WARRIOR, m_creature);
DoCast(m_creature, SPELL_WARRIOR);
DoScriptText(SAY_WARRIOR, me);
DoCast(me, SPELL_WARRIOR);
break;
case 2:
DoScriptText(SAY_DRUID, m_creature);
DoCast(m_creature, SPELL_DRUID);
DoScriptText(SAY_DRUID, me);
DoCast(me, SPELL_DRUID);
break;
case 3:
DoScriptText(SAY_PRIEST, m_creature);
DoCast(m_creature, SPELL_PRIEST);
DoScriptText(SAY_PRIEST, me);
DoCast(me, SPELL_PRIEST);
break;
case 4:
DoScriptText(SAY_PALADIN, m_creature);
DoCast(m_creature, SPELL_PALADIN);
DoScriptText(SAY_PALADIN, me);
DoCast(me, SPELL_PALADIN);
break;
case 5:
DoScriptText(SAY_SHAMAN, m_creature);
DoCast(m_creature, SPELL_SHAMAN);
DoScriptText(SAY_SHAMAN, me);
DoCast(me, SPELL_SHAMAN);
break;
case 6:
DoScriptText(SAY_WARLOCK, m_creature);
DoCast(m_creature, SPELL_WARLOCK);
DoScriptText(SAY_WARLOCK, me);
DoCast(me, SPELL_WARLOCK);
break;
case 7:
DoScriptText(SAY_HUNTER, m_creature);
DoCast(m_creature, SPELL_HUNTER);
DoScriptText(SAY_HUNTER, me);
DoCast(me, SPELL_HUNTER);
break;
case 8:
DoScriptText(SAY_ROGUE, m_creature);
DoCast(m_creature, SPELL_ROGUE);
DoScriptText(SAY_ROGUE, me);
DoCast(me, SPELL_ROGUE);
break;
}
@@ -206,10 +206,10 @@ struct boss_nefarianAI : public ScriptedAI
} else ClassCall_Timer -= diff;
//Phase3 begins when we are below X health
if (!Phase3 && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 20)
if (!Phase3 && (me->GetHealth()*100 / me->GetMaxHealth()) < 20)
{
Phase3 = true;
DoScriptText(SAY_RAISE_SKELETONS, m_creature);
DoScriptText(SAY_RAISE_SKELETONS, me);
}
DoMeleeAttackIfReady();
@@ -59,7 +59,7 @@ struct boss_razorgoreAI : public ScriptedAI
void JustDied(Unit* Killer)
{
DoScriptText(SAY_DEATH, m_creature);
DoScriptText(SAY_DEATH, me);
}
void UpdateAI(const uint32 diff)
@@ -70,40 +70,40 @@ struct boss_razorgoreAI : public ScriptedAI
//Cleave_Timer
if (Cleave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = urand(7000,10000);
} else Cleave_Timer -= diff;
//WarStomp_Timer
if (WarStomp_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WARSTOMP);
DoCast(me->getVictim(), SPELL_WARSTOMP);
WarStomp_Timer = urand(15000,25000);
} else WarStomp_Timer -= diff;
//FireballVolley_Timer
if (FireballVolley_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FIREBALLVOLLEY);
DoCast(me->getVictim(), SPELL_FIREBALLVOLLEY);
FireballVolley_Timer = urand(12000,15000);
} else FireballVolley_Timer -= diff;
//Conflagration_Timer
if (Conflagration_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CONFLAGRATION);
DoCast(me->getVictim(), SPELL_CONFLAGRATION);
//We will remove this threat reduction and add an aura check.
//if (DoGetThreat(m_creature->getVictim()))
//DoModifyThreatPercent(m_creature->getVictim(),-50);
//if (DoGetThreat(me->getVictim()))
//DoModifyThreatPercent(me->getVictim(),-50);
Conflagration_Timer = 12000;
} else Conflagration_Timer -= diff;
// Aura Check. If the gamer is affected by confliguration we attack a random gamer.
if (m_creature->getVictim() && m_creature->getVictim()->HasAura(SPELL_CONFLAGRATION))
if (me->getVictim() && me->getVictim()->HasAura(SPELL_CONFLAGRATION))
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true))
m_creature->TauntApply(pTarget);
me->TauntApply(pTarget);
DoMeleeAttackIfReady();
}
@@ -80,13 +80,13 @@ struct boss_vaelAI : public ScriptedAI
PlayerGUID = pTarget->GetGUID();
//10 seconds
DoScriptText(SAY_LINE1, m_creature);
DoScriptText(SAY_LINE1, me);
SpeechTimer = 10000;
SpeechNum = 0;
DoingSpeech = true;
m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
void KilledUnit(Unit *victim)
@@ -94,14 +94,14 @@ struct boss_vaelAI : public ScriptedAI
if (rand()%5)
return;
DoScriptText(SAY_KILLTARGET, m_creature, victim);
DoScriptText(SAY_KILLTARGET, me, victim);
}
void EnterCombat(Unit *who)
{
DoCast(m_creature, SPELL_ESSENCEOFTHERED);
DoCast(me, SPELL_ESSENCEOFTHERED);
DoZoneInCombat();
m_creature->SetHealth(int(m_creature->GetMaxHealth()*.3));
me->SetHealth(int(me->GetMaxHealth()*.3));
}
void UpdateAI(const uint32 diff)
@@ -115,22 +115,22 @@ struct boss_vaelAI : public ScriptedAI
{
case 0:
//16 seconds till next line
DoScriptText(SAY_LINE2, m_creature);
DoScriptText(SAY_LINE2, me);
SpeechTimer = 16000;
++SpeechNum;
break;
case 1:
//This one is actually 16 seconds but we only go to 10 seconds because he starts attacking after he says "I must fight this!"
DoScriptText(SAY_LINE3, m_creature);
DoScriptText(SAY_LINE3, me);
SpeechTimer = 10000;
++SpeechNum;
break;
case 2:
m_creature->setFaction(103);
if (PlayerGUID && Unit::GetUnit((*m_creature),PlayerGUID))
me->setFaction(103);
if (PlayerGUID && Unit::GetUnit((*me),PlayerGUID))
{
AttackStart(Unit::GetUnit((*m_creature),PlayerGUID));
DoCast(m_creature, SPELL_ESSENCEOFTHERED);
AttackStart(Unit::GetUnit((*me),PlayerGUID));
DoCast(me, SPELL_ESSENCEOFTHERED);
}
SpeechTimer = 0;
DoingSpeech = false;
@@ -144,23 +144,23 @@ struct boss_vaelAI : public ScriptedAI
return;
// Yell if hp lower than 15%
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 15 && !HasYelled)
if (me->GetHealth()*100 / me->GetMaxHealth() < 15 && !HasYelled)
{
DoScriptText(SAY_HALFLIFE, m_creature);
DoScriptText(SAY_HALFLIFE, me);
HasYelled = true;
}
//Cleave_Timer
if (Cleave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 15000;
} else Cleave_Timer -= diff;
//FlameBreath_Timer
if (FlameBreath_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FLAMEBREATH);
DoCast(me->getVictim(), SPELL_FLAMEBREATH);
FlameBreath_Timer = urand(4000,8000);
} else FlameBreath_Timer -= diff;
@@ -188,7 +188,7 @@ struct boss_vaelAI : public ScriptedAI
{
// have the victim cast the spell on himself otherwise the third effect aura will be applied
// to Vael instead of the player
m_creature->getVictim()->CastSpell(m_creature->getVictim(),SPELL_BURNINGADRENALINE,1);
me->getVictim()->CastSpell(me->getVictim(),SPELL_BURNINGADRENALINE,1);
BurningAdrenalineTank_Timer = 45000;
} else BurningAdrenalineTank_Timer -= diff;
@@ -196,7 +196,7 @@ struct boss_vaelAI : public ScriptedAI
//FireNova_Timer
if (FireNova_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FIRENOVA);
DoCast(me->getVictim(), SPELL_FIRENOVA);
FireNova_Timer = 5000;
} else FireNova_Timer -= diff;
@@ -204,9 +204,9 @@ struct boss_vaelAI : public ScriptedAI
if (TailSwipe_Timer <= diff)
{
//Only cast if we are behind
/*if (!m_creature->HasInArc(M_PI, m_creature->getVictim()))
/*if (!me->HasInArc(M_PI, me->getVictim()))
{
DoCast(m_creature->getVictim(), SPELL_TAILSWIPE);
DoCast(me->getVictim(), SPELL_TAILSWIPE);
}*/
TailSwipe_Timer = 20000;
@@ -178,27 +178,27 @@ struct boss_victor_nefariusAI : public ScriptedAI
NefarianGUID = 0;
NefCheckTime = 2000;
m_creature->SetUInt32Value(UNIT_NPC_FLAGS,1);
m_creature->setFaction(35);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUInt32Value(UNIT_NPC_FLAGS,1);
me->setFaction(35);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
void BeginEvent(Player *pTarget)
{
DoScriptText(SAY_GAMESBEGIN_2, m_creature);
DoScriptText(SAY_GAMESBEGIN_2, me);
//Trinity::Singleton<MapManager>::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().begin();
//Trinity::Singleton<MapManager>::Instance().GetMap(me->GetMapId(), me)->GetPlayers().begin();
/*
list <Player*>::const_iterator i = MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().begin();
list <Player*>::const_iterator i = MapManager::Instance().GetMap(me->GetMapId(), me)->GetPlayers().begin();
for (i = MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().begin(); i != MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->GetPlayers().end(); ++i)
for (i = MapManager::Instance().GetMap(me->GetMapId(), me)->GetPlayers().begin(); i != MapManager::Instance().GetMap(me->GetMapId(), me)->GetPlayers().end(); ++i)
{
AttackStart((*i));
}
*/
m_creature->SetUInt32Value(UNIT_NPC_FLAGS,0);
m_creature->setFaction(103);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetUInt32Value(UNIT_NPC_FLAGS,0);
me->setFaction(103);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
AttackStart(pTarget);
}
@@ -210,10 +210,10 @@ struct boss_victor_nefariusAI : public ScriptedAI
{
//We simply use this function to find players until we can use pMap->GetPlayers()
if (who && who->GetTypeId() == TYPEID_PLAYER && m_creature->IsHostileTo(who))
if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsHostileTo(who))
{
//Add them to our threat list
m_creature->AddThreat(who, 0.0f);
me->AddThreat(who, 0.0f);
}
}
@@ -260,7 +260,7 @@ struct boss_victor_nefariusAI : public ScriptedAI
++SpawnedAdds;
//Spawn Creature and force it to start attacking a random target
Spawned = m_creature->SummonCreature(CreatureID,ADD_X1,ADD_Y1,ADD_Z1,5.000,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
Spawned = me->SummonCreature(CreatureID,ADD_X1,ADD_Y1,ADD_Z1,5.000,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (pTarget && Spawned)
{
@@ -276,7 +276,7 @@ struct boss_victor_nefariusAI : public ScriptedAI
++SpawnedAdds;
Spawned = m_creature->SummonCreature(CreatureID,ADD_X2,ADD_Y2,ADD_Z2,5.000,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
Spawned = me->SummonCreature(CreatureID,ADD_X2,ADD_Y2,ADD_Z2,5.000,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000);
pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (pTarget && Spawned)
{
@@ -288,23 +288,23 @@ struct boss_victor_nefariusAI : public ScriptedAI
if (SpawnedAdds >= 42)
{
//Teleport Victor Nefarius way out of the map
//MapManager::Instance().GetMap(m_creature->GetMapId(), m_creature)->CreatureRelocation(m_creature,0,0,-5000,0);
//MapManager::Instance().GetMap(me->GetMapId(), me)->CreatureRelocation(me,0,0,-5000,0);
//Inturrupt any spell casting
m_creature->InterruptNonMeleeSpells(false);
me->InterruptNonMeleeSpells(false);
//Root self
DoCast(m_creature, 33356);
DoCast(me, 33356);
//Make super invis
DoCast(m_creature, 8149);
DoCast(me, 8149);
//Teleport self to a hiding spot (this causes errors in the Trinity log but no real issues)
DoTeleportTo(HIDE_X,HIDE_Y,HIDE_Z);
m_creature->addUnitState(UNIT_STAT_FLEEING);
me->addUnitState(UNIT_STAT_FLEEING);
//Spawn nef and have him attack a random target
Creature* Nefarian = m_creature->SummonCreature(CREATURE_NEFARIAN,NEF_X,NEF_Y,NEF_Z,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,120000);
Creature* Nefarian = me->SummonCreature(CREATURE_NEFARIAN,NEF_X,NEF_Y,NEF_Z,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,120000);
pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (pTarget && Nefarian)
{
@@ -322,14 +322,14 @@ struct boss_victor_nefariusAI : public ScriptedAI
{
if (NefCheckTime <= diff)
{
Unit* Nefarian = Unit::GetCreature((*m_creature),NefarianGUID);
Unit* Nefarian = Unit::GetCreature((*me),NefarianGUID);
//If nef is dead then we die to so the players get out of combat
//and cannot repeat the event
if (!Nefarian || !Nefarian->isAlive())
{
NefarianGUID = 0;
m_creature->ForcedDespawn();
me->ForcedDespawn();
}
NefCheckTime = 2000;
+10 -10
View File
@@ -61,7 +61,7 @@ struct boss_kruulAI : public ScriptedAI
void KilledUnit()
{
// When a player, pet or totem gets killed, Lord Kazzak casts this spell to instantly regenerate 70,000 health.
DoCast(m_creature, SPELL_CAPTURESOUL);
DoCast(me, SPELL_CAPTURESOUL);
}
void SummonHounds(Unit* pVictim)
@@ -80,7 +80,7 @@ struct boss_kruulAI : public ScriptedAI
if (ShadowVolley_Timer <= diff)
{
if (urand(0,99) < 45)
DoCast(m_creature->getVictim(), SPELL_SHADOWVOLLEY);
DoCast(me->getVictim(), SPELL_SHADOWVOLLEY);
ShadowVolley_Timer = 5000;
} else ShadowVolley_Timer -= diff;
@@ -89,7 +89,7 @@ struct boss_kruulAI : public ScriptedAI
if (Cleave_Timer <= diff)
{
if (urand(0,1))
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 10000;
} else Cleave_Timer -= diff;
@@ -98,7 +98,7 @@ struct boss_kruulAI : public ScriptedAI
if (ThunderClap_Timer <= diff)
{
if (urand(0,9) < 2)
DoCast(m_creature->getVictim(), SPELL_THUNDERCLAP);
DoCast(me->getVictim(), SPELL_THUNDERCLAP);
ThunderClap_Timer = 12000;
} else ThunderClap_Timer -= diff;
@@ -106,7 +106,7 @@ struct boss_kruulAI : public ScriptedAI
//TwistedReflection_Timer
if (TwistedReflection_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_TWISTEDREFLECTION);
DoCast(me->getVictim(), SPELL_TWISTEDREFLECTION);
TwistedReflection_Timer = 30000;
} else TwistedReflection_Timer -= diff;
@@ -114,7 +114,7 @@ struct boss_kruulAI : public ScriptedAI
if (VoidBolt_Timer <= diff)
{
if (urand(0,9) < 4)
DoCast(m_creature->getVictim(), SPELL_VOIDBOLT);
DoCast(me->getVictim(), SPELL_VOIDBOLT);
VoidBolt_Timer = 18000;
} else VoidBolt_Timer -= diff;
@@ -122,16 +122,16 @@ struct boss_kruulAI : public ScriptedAI
//Rage_Timer
if (Rage_Timer <= diff)
{
DoCast(m_creature, SPELL_RAGE);
DoCast(me, SPELL_RAGE);
Rage_Timer = 70000;
} else Rage_Timer -= diff;
//Hound_Timer
if (Hound_Timer <= diff)
{
SummonHounds(m_creature->getVictim());
SummonHounds(m_creature->getVictim());
SummonHounds(m_creature->getVictim());
SummonHounds(me->getVictim());
SummonHounds(me->getVictim());
SummonHounds(me->getVictim());
Hound_Timer = 45000;
} else Hound_Timer -= diff;
@@ -54,7 +54,7 @@ struct npc_ragged_johnAI : public ScriptedAI
{
if (who->HasAura(16468))
{
if (who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 15) && who->isInAccessiblePlaceFor(m_creature))
if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 15) && who->isInAccessiblePlaceFor(me))
{
DoCast(who, 16472);
CAST_PLR(who)->AreaExploredOrEventHappens(4866);
@@ -72,7 +72,7 @@ struct boss_mr_smiteAI : public ScriptedAI
void EnterCombat(Unit* pWho)
{
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
}
bool bCheckChances()
@@ -93,35 +93,35 @@ struct boss_mr_smiteAI : public ScriptedAI
if (uiTrashTimer <= uiDiff)
{
if (bCheckChances())
DoCast(m_creature, SPELL_TRASH);
DoCast(me, SPELL_TRASH);
uiTrashTimer = urand(6000,15500);
} else uiTrashTimer -= uiDiff;
if (uiSlamTimer <= uiDiff)
{
if (bCheckChances())
DoCast(m_creature->getVictim(), SPELL_SMITE_SLAM);
DoCast(me->getVictim(), SPELL_SMITE_SLAM);
uiSlamTimer = 11000;
} else uiSlamTimer -= uiDiff;
if (uiNimbleReflexesTimer <= uiDiff)
{
if (bCheckChances())
DoCast(m_creature, SPELL_NIMBLE_REFLEXES);
DoCast(me, SPELL_NIMBLE_REFLEXES);
uiNimbleReflexesTimer = urand(27300,60100);
} else uiNimbleReflexesTimer -= uiDiff;
/*END ACID-AI*/
if (uiHealth == 0 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 66 || uiHealth == 1 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 33)
if (uiHealth == 0 && me->GetHealth()*100 / me->GetMaxHealth() <= 66 || uiHealth == 1 && me->GetHealth()*100 / me->GetMaxHealth() <= 33)
{
++uiHealth;
DoCastAOE(SPELL_SMITE_STOMP,false);
SetCombatMovement(false);
if (pInstance)
if (GameObject* pGo = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_SMITE_CHEST)))
if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_SMITE_CHEST)))
{
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MovePoint(1,-3.00+pGo->GetPositionX(),pGo->GetPositionY(),pGo->GetPositionZ());
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(1,-3.00+pGo->GetPositionX(),pGo->GetPositionY(),pGo->GetPositionZ());
}
}
@@ -132,7 +132,7 @@ struct boss_mr_smiteAI : public ScriptedAI
switch(uiPhase)
{
case 1:
m_creature->HandleEmoteCommand(EMOTE_STATE_KNEEL); //dosen't work?
me->HandleEmoteCommand(EMOTE_STATE_KNEEL); //dosen't work?
uiTimer = 1000;
uiPhase = 2;
break;
@@ -146,7 +146,7 @@ struct boss_mr_smiteAI : public ScriptedAI
break;
case 3:
SetCombatMovement(true);
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), me->m_CombatDistance);
me->GetMotionMaster()->MoveChase(me->getVictim(), me->m_CombatDistance);
uiPhase = 0;
break;
+8 -8
View File
@@ -44,8 +44,8 @@ struct npc_narm_faulkAI : public ScriptedAI
void Reset()
{
lifeTimer = 120000;
m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
m_creature->SetStandState(UNIT_STAND_STATE_DEAD);
me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
me->SetStandState(UNIT_STAND_STATE_DEAD);
spellHit = false;
}
@@ -60,7 +60,7 @@ struct npc_narm_faulkAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
if (m_creature->IsStandState())
if (me->IsStandState())
{
if (lifeTimer <= diff)
{
@@ -76,11 +76,11 @@ struct npc_narm_faulkAI : public ScriptedAI
{
if (Spellkind->Id == 8593 && !spellHit)
{
DoCast(m_creature, 32343);
m_creature->SetStandState(UNIT_STAND_STATE_STAND);
m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
//m_creature->RemoveAllAuras();
DoScriptText(SAY_HEAL, m_creature);
DoCast(me, 32343);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
//me->RemoveAllAuras();
DoScriptText(SAY_HEAL, me);
spellHit = true;
}
}
+5 -5
View File
@@ -70,7 +70,7 @@ struct boss_twilight_corrupterAI : public ScriptedAI
}
void EnterCombat(Unit* who)
{
m_creature->MonsterYell("The Nightmare cannot be stopped!",0,m_creature->GetGUID());
me->MonsterYell("The Nightmare cannot be stopped!",0,me->GetGUID());
}
void KilledUnit(Unit* victim)
@@ -78,11 +78,11 @@ struct boss_twilight_corrupterAI : public ScriptedAI
if (victim->GetTypeId() == TYPEID_PLAYER)
{
++KillCount;
m_creature->MonsterTextEmote("Twilight Corrupter squeezes the last bit of life out of $N and swallows their soul.", victim->GetGUID(),true);
me->MonsterTextEmote("Twilight Corrupter squeezes the last bit of life out of $N and swallows their soul.", victim->GetGUID(),true);
if (KillCount == 3)
{
DoCast(m_creature, SPELL_LEVEL_UP, true);
DoCast(me, SPELL_LEVEL_UP, true);
KillCount = 0;
}
}
@@ -94,12 +94,12 @@ struct boss_twilight_corrupterAI : public ScriptedAI
return;
if (SoulCorruption_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SOUL_CORRUPTION);
DoCast(me->getVictim(), SPELL_SOUL_CORRUPTION);
SoulCorruption_Timer = rand()%4000+15000; //gotta confirm Timers
} else SoulCorruption_Timer-=diff;
if (CreatureOfNightmare_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CREATURE_OF_NIGHTMARE);
DoCast(me->getVictim(), SPELL_CREATURE_OF_NIGHTMARE);
CreatureOfNightmare_Timer = 45000; //gotta confirm Timers
} else CreatureOfNightmare_Timer-=diff;
DoMeleeAttackIfReady();
@@ -45,7 +45,7 @@ struct mobs_ghoul_flayerAI : public ScriptedAI
void JustDied(Unit* Killer)
{
if (Killer->GetTypeId() == TYPEID_PLAYER)
m_creature->SummonCreature(11064, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000);
me->SummonCreature(11064, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 60000);
}
};
@@ -89,8 +89,8 @@ struct npc_darrowshire_spiritAI : public ScriptedAI
void Reset()
{
DoCast(m_creature, SPELL_SPIRIT_SPAWNIN);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
DoCast(me, SPELL_SPIRIT_SPAWNIN);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
void EnterCombat(Unit *who) {}
@@ -43,8 +43,8 @@ struct npc_henze_faulkAI : public ScriptedAI
void Reset()
{
lifeTimer = 120000;
m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
m_creature->SetStandState(UNIT_STAND_STATE_DEAD); // lay down
me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD);
me->SetStandState(UNIT_STAND_STATE_DEAD); // lay down
spellHit = false;
}
@@ -59,7 +59,7 @@ struct npc_henze_faulkAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
if (m_creature->IsStandState())
if (me->IsStandState())
{
if (lifeTimer <= diff)
{
@@ -75,11 +75,11 @@ struct npc_henze_faulkAI : public ScriptedAI
{
if (Spellkind->Id == 8593 && !spellHit)
{
DoCast(m_creature, 32343);
m_creature->SetStandState(UNIT_STAND_STATE_STAND);
m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
//m_creature->RemoveAllAuras();
DoScriptText(SAY_HEAL, m_creature);
DoCast(me, 32343);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
//me->RemoveAllAuras();
DoScriptText(SAY_HEAL, me);
spellHit = true;
}
}
+36 -36
View File
@@ -61,9 +61,9 @@ struct npc_prospector_anvilwardAI : public npc_escortAI
switch (i)
{
case 0: DoScriptText(SAY_ANVIL1, m_creature, pPlayer); break;
case 5: DoScriptText(SAY_ANVIL2, m_creature, pPlayer); break;
case 6: m_creature->setFaction(24); break;
case 0: DoScriptText(SAY_ANVIL1, me, pPlayer); break;
case 5: DoScriptText(SAY_ANVIL2, me, pPlayer); break;
case 6: me->setFaction(24); break;
}
}
@@ -191,15 +191,15 @@ struct npc_secondTrialAI : public ScriptedAI
questPhase = 0;
summonerGuid = 0;
m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_KNEEL);
m_creature->setFaction(FACTION_FRIENDLY);
me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_KNEEL);
me->setFaction(FACTION_FRIENDLY);
spellFlashLight = false;
spellJustice = false;
spellJudLight = false;
spellCommand = false;
switch(m_creature->GetEntry())
switch(me->GetEntry())
{
case CHAMPION_BLOODWRATH:
spellFlashLight = true;
@@ -231,13 +231,13 @@ struct npc_secondTrialAI : public ScriptedAI
if (questPhase == 1)
if (timer <= diff)
{
m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND);
m_creature->setFaction(FACTION_HOSTILE);
me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND);
me->setFaction(FACTION_HOSTILE);
questPhase = 0;
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
m_creature->AddThreat(pTarget, 5000000.0f);
me->AddThreat(pTarget, 5000000.0f);
AttackStart(pTarget);
}
}
@@ -249,10 +249,10 @@ struct npc_secondTrialAI : public ScriptedAI
// healer
if (spellFlashLight)
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 70)
if (me->GetHealth()*100 / me->GetMaxHealth() < 70)
if (timerFlashLight <= diff)
{
DoCast(m_creature, SPELL_FLASH_OF_LIGHT);
DoCast(me, SPELL_FLASH_OF_LIGHT);
timerFlashLight = TIMER_FLASH_OF_LIGHT + rand()%TIMER_FLASH_OF_LIGHT;
}
else
@@ -261,7 +261,7 @@ struct npc_secondTrialAI : public ScriptedAI
if (spellJustice)
if (timerJustice <= diff)
{
DoCast(m_creature, SPELL_SEAL_OF_JUSTICE);
DoCast(me, SPELL_SEAL_OF_JUSTICE);
timerJustice = TIMER_SEAL_OF_JUSTICE + rand()%TIMER_SEAL_OF_JUSTICE;
}
else
@@ -270,7 +270,7 @@ struct npc_secondTrialAI : public ScriptedAI
if (spellJudLight)
if (timerJudLight <= diff)
{
DoCast(m_creature, SPELL_JUDGEMENT_OF_LIGHT);
DoCast(me, SPELL_JUDGEMENT_OF_LIGHT);
timerJudLight = TIMER_JUDGEMENT_OF_LIGHT + rand()%TIMER_JUDGEMENT_OF_LIGHT;
}
else
@@ -279,7 +279,7 @@ struct npc_secondTrialAI : public ScriptedAI
if (spellCommand)
if (timerCommand <= diff)
{
DoCast(m_creature, TIMER_SEAL_OF_COMMAND);
DoCast(me, TIMER_SEAL_OF_COMMAND);
timerCommand = TIMER_SEAL_OF_COMMAND + rand()%TIMER_SEAL_OF_COMMAND;
}
else
@@ -333,23 +333,23 @@ struct master_kelerun_bloodmournAI : public ScriptedAI
{
if (timer <= diff)
{
if (Creature* paladinSpawn = Unit::GetCreature((*m_creature), paladinGuid[paladinPhase]))
if (Creature* paladinSpawn = Unit::GetCreature((*me), paladinGuid[paladinPhase]))
{
CAST_AI(npc_secondTrialAI, paladinSpawn->AI())->Activate(m_creature->GetGUID());
CAST_AI(npc_secondTrialAI, paladinSpawn->AI())->Activate(me->GetGUID());
switch(paladinPhase)
{
case 0:
DoScriptText(TEXT_SECOND_TRIAL_1,m_creature);
DoScriptText(TEXT_SECOND_TRIAL_1,me);
break;
case 1:
DoScriptText(TEXT_SECOND_TRIAL_2,m_creature);
DoScriptText(TEXT_SECOND_TRIAL_2,me);
break;
case 2:
DoScriptText(TEXT_SECOND_TRIAL_3,m_creature);
DoScriptText(TEXT_SECOND_TRIAL_3,me);
break;
case 3:
DoScriptText(TEXT_SECOND_TRIAL_4,m_creature);
DoScriptText(TEXT_SECOND_TRIAL_4,me);
break;
}
}
@@ -431,11 +431,11 @@ void npc_secondTrialAI::JustDied(Unit* Killer)
{
if (Killer->GetTypeId() == TYPEID_PLAYER)
{
if (Creature *pSummoner = Unit::GetCreature((*m_creature), summonerGuid))
if (Creature *pSummoner = Unit::GetCreature((*me), summonerGuid))
CAST_AI(master_kelerun_bloodmournAI, pSummoner->AI())->SecondTrialKill();
// last kill quest complete for group
if (m_creature->GetEntry() == CHAMPION_SUNSTRIKER)
if (me->GetEntry() == CHAMPION_SUNSTRIKER)
{
if (Group *pGroup = CAST_PLR(Killer)->GetGroup())
{
@@ -444,7 +444,7 @@ void npc_secondTrialAI::JustDied(Unit* Killer)
Player *pGroupGuy = itr->getSource();
// for any leave or dead (with not released body) group member at appropriate distance
if (pGroupGuy && pGroupGuy->IsAtGroupRewardDistance(m_creature) && !pGroupGuy->GetCorpse() && pGroupGuy->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE)
if (pGroupGuy && pGroupGuy->IsAtGroupRewardDistance(me) && !pGroupGuy->GetCorpse() && pGroupGuy->GetQuestStatus(QUEST_SECOND_TRIAL) == QUEST_STATUS_INCOMPLETE)
pGroupGuy->CompleteQuest(QUEST_SECOND_TRIAL);
}
}
@@ -500,7 +500,7 @@ bool GOHello_go_second_trial(Player* pPlayer, GameObject* pGO)
struct npc_apprentice_mirvedaAI : public ScriptedAI
{
npc_apprentice_mirvedaAI(Creature* c) : ScriptedAI(c), Summons(m_creature) {}
npc_apprentice_mirvedaAI(Creature* c) : ScriptedAI(c), Summons(me) {}
uint32 KillCount;
uint64 PlayerGUID;
@@ -519,7 +519,7 @@ struct npc_apprentice_mirvedaAI : public ScriptedAI
void JustSummoned(Creature *summoned)
{
summoned->AI()->AttackStart(m_creature);
summoned->AI()->AttackStart(me);
Summons.Summon(summoned);
}
@@ -544,9 +544,9 @@ struct npc_apprentice_mirvedaAI : public ScriptedAI
if (Summon)
{
m_creature->SummonCreature(MOB_GHARZUL, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000);
m_creature->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000);
m_creature->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000);
me->SummonCreature(MOB_GHARZUL, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000);
me->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000);
me->SummonCreature(MOB_ANGERSHADE, 8745, -7134.32, 35.22, 0, TEMPSUMMON_CORPSE_DESPAWN, 4000);
Summon = false;
}
}
@@ -613,7 +613,7 @@ struct npc_infused_crystalAI : public Scripted_NoMovementAI
void MoveInLineOfSight(Unit* who)
{
if (!Progress && who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 10.0f))
if (!Progress && who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 10.0f))
{
if (CAST_PLR(who)->GetQuestStatus(QUEST_POWERING_OUR_DEFENSES) == QUEST_STATUS_INCOMPLETE)
{
@@ -627,7 +627,7 @@ struct npc_infused_crystalAI : public Scripted_NoMovementAI
void JustSummoned(Creature *summoned)
{
summoned->AI()->AttackStart(m_creature);
summoned->AI()->AttackStart(me);
}
void JustDied(Unit* killer)
@@ -641,14 +641,14 @@ struct npc_infused_crystalAI : public Scripted_NoMovementAI
{
if (EndTimer < diff && Progress)
{
DoScriptText(EMOTE, m_creature);
DoScriptText(EMOTE, me);
Completed = true;
if (PlayerGUID)
if (Player* pPlayer = Unit::GetPlayer(PlayerGUID))
CAST_PLR(pPlayer)->CompleteQuest(QUEST_POWERING_OUR_DEFENSES);
m_creature->DealDamage(m_creature,m_creature->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
m_creature->RemoveCorpse();
me->DealDamage(me,me->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
me->RemoveCorpse();
} else EndTimer -= diff;
if (WaveTimer < diff && !Completed && Progress)
@@ -656,9 +656,9 @@ struct npc_infused_crystalAI : public Scripted_NoMovementAI
uint32 ran1 = rand()%8;
uint32 ran2 = rand()%8;
uint32 ran3 = rand()%8;
m_creature->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran1].x, SpawnLocations[ran1].y, SpawnLocations[ran1].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000);
m_creature->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran2].x, SpawnLocations[ran2].y, SpawnLocations[ran2].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000);
m_creature->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran3].x, SpawnLocations[ran3].y, SpawnLocations[ran3].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000);
me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran1].x, SpawnLocations[ran1].y, SpawnLocations[ran1].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000);
me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran2].x, SpawnLocations[ran2].y, SpawnLocations[ran2].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000);
me->SummonCreature(MOB_ENRAGED_WRAITH, SpawnLocations[ran3].x, SpawnLocations[ran3].y, SpawnLocations[ran3].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000);
WaveTimer = 30000;
} else WaveTimer -= diff;
}
+17 -17
View File
@@ -166,44 +166,44 @@ struct npc_ranger_lilathaAI : public npc_escortAI
{
case 0:
{
m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
me->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20))
Cage->SetGoState(GO_STATE_ACTIVE);
DoScriptText(SAY_START, m_creature, pPlayer);
DoScriptText(SAY_START, me, pPlayer);
break;
}
case 5:
DoScriptText(SAY_PROGRESS1, m_creature, pPlayer);
DoScriptText(SAY_PROGRESS1, me, pPlayer);
case 11:
DoScriptText(SAY_PROGRESS2, m_creature, pPlayer);
m_creature->SetOrientation(4.762841);
DoScriptText(SAY_PROGRESS2, me, pPlayer);
me->SetOrientation(4.762841);
break;
case 18:
{
DoScriptText(SAY_PROGRESS3, m_creature, pPlayer);
Creature* Summ1 = m_creature->SummonCreature(16342, 7627.083984, -7532.538086, 152.128616, 1.082733, TEMPSUMMON_DEAD_DESPAWN, 0);
Creature* Summ2 = m_creature->SummonCreature(16343, 7620.432129, -7532.550293, 152.454865, 0.827478, TEMPSUMMON_DEAD_DESPAWN, 0);
DoScriptText(SAY_PROGRESS3, me, pPlayer);
Creature* Summ1 = me->SummonCreature(16342, 7627.083984, -7532.538086, 152.128616, 1.082733, TEMPSUMMON_DEAD_DESPAWN, 0);
Creature* Summ2 = me->SummonCreature(16343, 7620.432129, -7532.550293, 152.454865, 0.827478, TEMPSUMMON_DEAD_DESPAWN, 0);
if (Summ1 && Summ2)
{
Summ1->Attack(m_creature, true);
Summ1->Attack(me, true);
Summ2->Attack(pPlayer, true);
}
m_creature->AI()->AttackStart(Summ1);
me->AI()->AttackStart(Summ1);
break;
}
case 19: m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break;
case 25: m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break;
case 19: me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break;
case 25: me->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break;
case 30:
if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER)
CAST_PLR(pPlayer)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS,m_creature);
CAST_PLR(pPlayer)->GroupEventHappens(QUEST_ESCAPE_FROM_THE_CATACOMBS,me);
break;
case 32:
m_creature->SetOrientation(2.978281);
DoScriptText(SAY_END1, m_creature, pPlayer);
me->SetOrientation(2.978281);
DoScriptText(SAY_END1, me, pPlayer);
break;
case 33:
m_creature->SetOrientation(5.858011);
DoScriptText(SAY_END2, m_creature, pPlayer);
me->SetOrientation(5.858011);
DoScriptText(SAY_END2, me, pPlayer);
Unit* CaptainHelios = me->FindNearestCreature(NPC_CAPTAIN_HELIOS, 50);
if (CaptainHelios)
DoScriptText(SAY_CAPTAIN_ANSWER, CaptainHelios, pPlayer);
@@ -133,7 +133,7 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
for (std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr)
{
if (GameObject* pGo = GameObject::GetGameObject(*m_creature, *itr))
if (GameObject* pGo = GameObject::GetGameObject(*me, *itr))
{
if (pGo)
{
@@ -144,7 +144,7 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
trigger->CastSpell(trigger,35470,true);
}
pGo->RemoveFromWorld();
//pGo->CastSpell(m_creature,12158); makes all die?!
//pGo->CastSpell(me,12158); makes all die?!
}
}
}
@@ -152,11 +152,11 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
if (bBool)
{
if (pInstance)
if (GameObject* pGo = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
pInstance->HandleGameObject(NULL,false,pGo);
}else
if (pInstance)
if (GameObject* pGo = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT)))
if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT)))
pInstance->HandleGameObject(NULL,false,pGo);
}
@@ -167,11 +167,11 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
if (bBool)
{
if (GameObject* pGo = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
m_creature->SetFacingToObject(pGo);
if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
me->SetFacingToObject(pGo);
}else
if (GameObject* pGo = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT)))
m_creature->SetFacingToObject(pGo);
if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT)))
me->SetFacingToObject(pGo);
}
void RestoreAll()
@@ -179,23 +179,23 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
if (!pInstance)
return;
if (GameObject* pGo = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
pInstance->HandleGameObject(NULL,false,pGo);
if (GameObject* pGo = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT)))
if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT)))
pInstance->HandleGameObject(NULL,false,pGo);
if (!GoSummonList.empty())
for (std::list<uint64>::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr)
{
if (GameObject* pGo = GameObject::GetGameObject(*m_creature, *itr))
if (GameObject* pGo = GameObject::GetGameObject(*me, *itr))
pGo->RemoveFromWorld();
}
if (!SummonList.empty())
for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
{
if (Creature* pSummon = Unit::GetCreature(*m_creature, *itr))
if (Creature* pSummon = Unit::GetCreature(*me, *itr))
{
if (pSummon->isAlive())
pSummon->DisappearAndDie();
@@ -207,7 +207,7 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
void AggroAllPlayers(Creature* pTemp)
{
Map::PlayerList const &PlList = m_creature->GetMap()->GetPlayers();
Map::PlayerList const &PlList = me->GetMap()->GetPlayers();
if (PlList.isEmpty())
return;
@@ -233,8 +233,8 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
{
//just in case
if (GetPlayerForEscort())
if (m_creature->getFaction() != GetPlayerForEscort()->getFaction())
m_creature->setFaction(GetPlayerForEscort()->getFaction());
if (me->getFaction() != GetPlayerForEscort()->getFaction())
me->setFaction(GetPlayerForEscort()->getFaction());
switch(uiPoint)
{
@@ -266,7 +266,7 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
break;
case 14:
SetInFace(false);
DoScriptText(SAY_BLASTMASTER_26,m_creature);
DoScriptText(SAY_BLASTMASTER_26,me);
SetEscortPaused(true);
NextStep(5000,false,20);
break;
@@ -279,7 +279,7 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
{
case 1:
SetEscortPaused(true);
DoScriptText(SAY_BLASTMASTER_0,m_creature);
DoScriptText(SAY_BLASTMASTER_0,me);
NextStep(1500,true);
break;
case 2:
@@ -305,19 +305,19 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
switch(uiCase)
{
case 1:
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[4], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[5], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[6], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[7], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[8], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[9], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[4], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[5], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[6], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[7], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[8], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[9], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
break;
case 2:
if (GameObject* pGo = m_creature->SummonGameObject(183410, -533.140,-105.322,-156.016, 0, 0, 0, 0, 0, 1000))
if (GameObject* pGo = me->SummonGameObject(183410, -533.140,-105.322,-156.016, 0, 0, 0, 0, 0, 1000))
{
GoSummonList.push_back(pGo->GetGUID());
pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it!
@@ -325,34 +325,34 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
Summon(3);
break;
case 3:
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
DoScriptText(SAY_BLASTMASTER_19,m_creature);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
DoScriptText(SAY_BLASTMASTER_19,me);
break;
case 4:
if (GameObject* pGo = m_creature->SummonGameObject(183410, -542.199,-96.854,-155.790, 0, 0, 0, 0, 0, 1000))
if (GameObject* pGo = me->SummonGameObject(183410, -542.199,-96.854,-155.790, 0, 0, 0, 0, 0, 1000))
{
GoSummonList.push_back(pGo->GetGUID());
pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1);
}
break;
case 5:
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
DoScriptText(SAY_BLASTMASTER_15,m_creature);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
DoScriptText(SAY_BLASTMASTER_15,me);
break;
case 6:
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[10], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[11], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[12], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[13], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
m_creature->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[14], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[10], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[11], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[12], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[13], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[14], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
break;
case 7:
if (GameObject* pGo = m_creature->SummonGameObject(183410, -507.820,-103.333,-151.353, 0, 0, 0, 0, 0, 1000))
if (GameObject* pGo = me->SummonGameObject(183410, -507.820,-103.333,-151.353, 0, 0, 0, 0, 0, 1000))
{
GoSummonList.push_back(pGo->GetGUID());
pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it!
@@ -360,16 +360,16 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
}
break;
case 8:
if (GameObject* pGo = m_creature->SummonGameObject(183410, -511.829,-86.249,-151.431, 0, 0, 0, 0, 0, 1000))
if (GameObject* pGo = me->SummonGameObject(183410, -511.829,-86.249,-151.431, 0, 0, 0, 0, 0, 1000))
{
GoSummonList.push_back(pGo->GetGUID());
pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); //We can't use it!
}
break;
case 9:
if (Creature* pGrubbis = m_creature->SummonCreature(NPC_GRUBBIS, SpawnPosition[15], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000))
if (Creature* pGrubbis = me->SummonCreature(NPC_GRUBBIS, SpawnPosition[15], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000))
DoScriptText(SAY_GRUBBIS,pGrubbis);
m_creature->SummonCreature(NPC_CHOMPER, SpawnPosition[16], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
me->SummonCreature(NPC_CHOMPER, SpawnPosition[16], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000);
break;
}
}
@@ -383,7 +383,7 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
switch(uiPhase)
{
case 1:
DoScriptText(SAY_BLASTMASTER_1,m_creature);
DoScriptText(SAY_BLASTMASTER_1,me);
NextStep(1500,true);
break;
case 2:
@@ -391,34 +391,34 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
NextStep(0,false,0);
break;
case 3:
DoScriptText(SAY_BLASTMASTER_2,m_creature);
DoScriptText(SAY_BLASTMASTER_2,me);
SetEscortPaused(false);
NextStep(0,false,0);
break;
case 4:
DoScriptText(SAY_BLASTMASTER_3,m_creature);
DoScriptText(SAY_BLASTMASTER_3,me);
NextStep(3000,true);
break;
case 5:
DoScriptText(SAY_BLASTMASTER_4,m_creature);
DoScriptText(SAY_BLASTMASTER_4,me);
NextStep(3000,true);
break;
case 6:
SetInFace(true);
DoScriptText(SAY_BLASTMASTER_5,m_creature);
DoScriptText(SAY_BLASTMASTER_5,me);
Summon(1);
if (pInstance)
if (GameObject* pGo = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_RIGHT)))
pInstance->HandleGameObject(NULL,true,pGo);
NextStep(3000,true);
break;
case 7:
DoScriptText(SAY_BLASTMASTER_6,m_creature);
DoScriptText(SAY_BLASTMASTER_6,me);
SetEscortPaused(false);
NextStep(0,false,0);
break;
case 8:
m_creature->HandleEmoteCommand(EMOTE_STATE_WORK);
me->HandleEmoteCommand(EMOTE_STATE_WORK);
NextStep(25000,true);
break;
case 9:
@@ -430,37 +430,37 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
NextStep(0,false);
break;
case 11:
DoScriptText(SAY_BLASTMASTER_17,m_creature);
DoScriptText(SAY_BLASTMASTER_17,me);
NextStep(5000,true);
break;
case 12:
DoScriptText(SAY_BLASTMASTER_18,m_creature);
DoScriptText(SAY_BLASTMASTER_18,me);
NextStep(5000,true);
break;
case 13:
DoScriptText(SAY_BLASTMASTER_20,m_creature);
DoScriptText(SAY_BLASTMASTER_20,me);
CaveDestruction(true);
NextStep(8000,true);
break;
case 14:
DoScriptText(SAY_BLASTMASTER_21,m_creature);
DoScriptText(SAY_BLASTMASTER_21,me);
NextStep(8500,true);
break;
case 15:
DoScriptText(SAY_BLASTMASTER_22,m_creature);
DoScriptText(SAY_BLASTMASTER_22,me);
NextStep(2000,true);
break;
case 16:
DoScriptText(SAY_BLASTMASTER_23,m_creature);
DoScriptText(SAY_BLASTMASTER_23,me);
SetInFace(false);
if (pInstance)
if (GameObject* pGo = GameObject::GetGameObject((*m_creature),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT)))
if (GameObject* pGo = GameObject::GetGameObject((*me),pInstance->GetData64(DATA_GO_CAVE_IN_LEFT)))
pInstance->HandleGameObject(NULL,true,pGo);
NextStep(2000,true);
break;
case 17:
SetEscortPaused(false);
DoScriptText(SAY_BLASTMASTER_24,m_creature);
DoScriptText(SAY_BLASTMASTER_24,me);
Summon(6);
NextStep(0,false);
break;
@@ -471,11 +471,11 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
case 19:
SetInFace(false);
Summon(8);
DoScriptText(SAY_BLASTMASTER_25,m_creature);
DoScriptText(SAY_BLASTMASTER_25,me);
NextStep(0,false);
break;
case 20:
DoScriptText(SAY_BLASTMASTER_27,m_creature);
DoScriptText(SAY_BLASTMASTER_27,me);
NextStep(2000,true);
break;
case 21:
@@ -484,7 +484,7 @@ struct npc_blastmaster_emi_shortfuseAI : public npc_escortAI
break;
case 22:
CaveDestruction(false);
DoScriptText(SAY_BLASTMASTER_20,m_creature);
DoScriptText(SAY_BLASTMASTER_20,me);
NextStep(0,false);
break;
}
@@ -545,10 +545,10 @@ struct boss_grubbisAI : public ScriptedAI
void SetDataSummoner()
{
if (!m_creature->isSummon())
if (!me->isSummon())
return;
if (Unit* pSummon = CAST_SUM(m_creature)->GetSummoner())
if (Unit* pSummon = CAST_SUM(me)->GetSummoner())
CAST_CRE(pSummon)->AI()->SetData(2,1);
}
@@ -562,10 +562,10 @@ struct boss_grubbisAI : public ScriptedAI
void JustDied(Unit* pKiller)
{
if (!m_creature->isSummon())
if (!me->isSummon())
return;
if (Unit* pSummon = CAST_SUM(m_creature)->GetSummoner())
if (Unit* pSummon = CAST_SUM(me)->GetSummoner())
CAST_CRE(pSummon)->AI()->SetData(2,2);
}
};
+18 -18
View File
@@ -61,15 +61,15 @@ struct npc_00x09hlAI : public npc_escortAI
switch(uiPointId)
{
case 26:
DoScriptText(SAY_OOX_AMBUSH, m_creature);
DoScriptText(SAY_OOX_AMBUSH, me);
break;
case 43:
DoScriptText(SAY_OOX_AMBUSH, m_creature);
DoScriptText(SAY_OOX_AMBUSH, me);
break;
case 64:
DoScriptText(SAY_OOX_END, m_creature);
DoScriptText(SAY_OOX_END, me);
if (Player* pPlayer = GetPlayerForEscort())
pPlayer->GroupEventHappens(QUEST_RESQUE_OOX_09, m_creature);
pPlayer->GroupEventHappens(QUEST_RESQUE_OOX_09, me);
break;
}
}
@@ -92,8 +92,8 @@ struct npc_00x09hlAI : public npc_escortAI
{
const Position src = {-141.151581f, -4291.213867f, 120.130f, 0};
Position dst;
m_creature->GetRandomPoint(src, 7.0f, dst);
m_creature->SummonCreature(NPC_VILE_AMBUSHER, dst, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000);
me->GetRandomPoint(src, 7.0f, dst);
me->SummonCreature(NPC_VILE_AMBUSHER, dst, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000);
}
break;
}
@@ -105,14 +105,14 @@ struct npc_00x09hlAI : public npc_escortAI
return;
if (rand()%1)
DoScriptText(SAY_OOX_AGGRO1, m_creature);
DoScriptText(SAY_OOX_AGGRO1, me);
else
DoScriptText(SAY_OOX_AGGRO2, m_creature);
DoScriptText(SAY_OOX_AGGRO2, me);
}
void JustSummoned(Creature* pSummoned)
{
pSummoned->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ());
pSummoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
}
};
@@ -218,7 +218,7 @@ struct npc_rinjiAI : public npc_escortAI
return;
//only if attacked and escorter is not in combat?
DoScriptText(RAND(SAY_RIN_HELP_1,SAY_RIN_HELP_2), m_creature);
DoScriptText(RAND(SAY_RIN_HELP_1,SAY_RIN_HELP_2), me);
}
}
@@ -227,13 +227,13 @@ struct npc_rinjiAI : public npc_escortAI
if (!bFirst)
m_iSpawnId = 1;
m_creature->SummonCreature(NPC_RANGER,
me->SummonCreature(NPC_RANGER,
m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f,
TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000);
for (int i = 0; i < 2; ++i)
{
m_creature->SummonCreature(NPC_OUTRUNNER,
me->SummonCreature(NPC_OUTRUNNER,
m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f,
TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000);
}
@@ -255,7 +255,7 @@ struct npc_rinjiAI : public npc_escortAI
switch(uiPointId)
{
case 1:
DoScriptText(SAY_RIN_FREE, m_creature, pPlayer);
DoScriptText(SAY_RIN_FREE, me, pPlayer);
break;
case 7:
DoSpawnAmbush(true);
@@ -264,8 +264,8 @@ struct npc_rinjiAI : public npc_escortAI
DoSpawnAmbush(false);
break;
case 17:
DoScriptText(SAY_RIN_COMPLETE, m_creature, pPlayer);
pPlayer->GroupEventHappens(QUEST_RINJI_TRAPPED, m_creature);
DoScriptText(SAY_RIN_COMPLETE, me, pPlayer);
pPlayer->GroupEventHappens(QUEST_RINJI_TRAPPED, me);
SetRun();
m_uiPostEventCount = 1;
break;
@@ -288,18 +288,18 @@ struct npc_rinjiAI : public npc_escortAI
switch(m_uiPostEventCount)
{
case 1:
DoScriptText(SAY_RIN_PROGRESS_1, m_creature, pPlayer);
DoScriptText(SAY_RIN_PROGRESS_1, me, pPlayer);
++m_uiPostEventCount;
break;
case 2:
DoScriptText(SAY_RIN_PROGRESS_2, m_creature, pPlayer);
DoScriptText(SAY_RIN_PROGRESS_2, me, pPlayer);
m_uiPostEventCount = 0;
break;
}
}
else
{
m_creature->ForcedDespawn();
me->ForcedDespawn();
return;
}
}
@@ -63,13 +63,13 @@ struct npc_converted_sentryAI : public ScriptedAI
{
uint32 i = urand(1,2);
if (i == 1)
DoScriptText(SAY_CONVERTED_1, m_creature);
DoScriptText(SAY_CONVERTED_1, me);
else
DoScriptText(SAY_CONVERTED_2, m_creature);
DoScriptText(SAY_CONVERTED_2, me);
DoCast(m_creature, SPELL_CONVERT_CREDIT);
if (m_creature->isPet())
CAST_PET(m_creature)->SetDuration(7500);
DoCast(me, SPELL_CONVERT_CREDIT);
if (me->isPet())
CAST_PET(me)->SetDuration(7500);
Credit = true;
} else Timer -= diff;
}
@@ -107,20 +107,20 @@ struct npc_greengill_slaveAI : public ScriptedAI
if (!caster)
return;
if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == ORB && !m_creature->HasAura(ENRAGE))
if (caster->GetTypeId() == TYPEID_PLAYER && spell->Id == ORB && !me->HasAura(ENRAGE))
{
PlayerGUID = caster->GetGUID();
if (PlayerGUID)
{
Unit* plr = Unit::GetUnit((*m_creature), PlayerGUID);
Unit* plr = Unit::GetUnit((*me), PlayerGUID);
if (plr && CAST_PLR(plr)->GetQuestStatus(QUESTG) == QUEST_STATUS_INCOMPLETE)
DoCast(plr, 45110, true);
}
DoCast(m_creature, ENRAGE);
DoCast(me, ENRAGE);
Unit* Myrmidon = me->FindNearestCreature(DM, 70);
if (Myrmidon)
{
m_creature->AddThreat(Myrmidon, 100000.0f);
me->AddThreat(Myrmidon, 100000.0f);
AttackStart(Myrmidon);
}
}
@@ -60,22 +60,22 @@ struct boss_curatorAI : public ScriptedAI
Enraged = false;
Evocating = false;
m_creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, true);
me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_ARCANE, true);
}
void KilledUnit(Unit *victim)
{
DoScriptText(RAND(SAY_KILL1,SAY_KILL2), m_creature);
DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me);
}
void JustDied(Unit *victim)
{
DoScriptText(SAY_DEATH, m_creature);
DoScriptText(SAY_DEATH, me);
}
void EnterCombat(Unit *who)
{
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
}
void UpdateAI(const uint32 diff)
@@ -89,17 +89,17 @@ struct boss_curatorAI : public ScriptedAI
//if evocate, then break evocate
if (Evocating)
{
if (m_creature->HasAura(SPELL_EVOCATION))
m_creature->RemoveAurasDueToSpell(SPELL_EVOCATION);
if (me->HasAura(SPELL_EVOCATION))
me->RemoveAurasDueToSpell(SPELL_EVOCATION);
Evocating = false;
}
//may not be correct SAY (generic hard enrage)
DoScriptText(SAY_ENRAGE, m_creature);
DoScriptText(SAY_ENRAGE, me);
m_creature->InterruptNonMeleeSpells(true);
DoCast(m_creature, SPELL_BERSERK);
me->InterruptNonMeleeSpells(true);
DoCast(me, SPELL_BERSERK);
//don't know if he's supposed to do summon/evocate after hard enrage (probably not)
Enraged = true;
@@ -108,7 +108,7 @@ struct boss_curatorAI : public ScriptedAI
if (Evocating)
{
//not supposed to do anything while evocate
if (m_creature->HasAura(SPELL_EVOCATION))
if (me->HasAura(SPELL_EVOCATION))
return;
else
Evocating = false;
@@ -130,17 +130,17 @@ struct boss_curatorAI : public ScriptedAI
}
//Reduce Mana by 10% of max health
if (int32 mana = m_creature->GetMaxPower(POWER_MANA))
if (int32 mana = me->GetMaxPower(POWER_MANA))
{
mana /= 10;
m_creature->ModifyPower(POWER_MANA, -mana);
me->ModifyPower(POWER_MANA, -mana);
//if this get's us below 10%, then we evocate (the 10th should be summoned now)
if (m_creature->GetPower(POWER_MANA)*100 / m_creature->GetMaxPower(POWER_MANA) < 10)
if (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA) < 10)
{
DoScriptText(SAY_EVOCATE, m_creature);
m_creature->InterruptNonMeleeSpells(false);
DoCast(m_creature, SPELL_EVOCATION);
DoScriptText(SAY_EVOCATE, me);
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_EVOCATION);
Evocating = true;
//no AddTimer cooldown, this will make first flare appear instantly after evocate end, like expected
return;
@@ -149,7 +149,7 @@ struct boss_curatorAI : public ScriptedAI
{
if (urand(0,1) == 0)
{
DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), m_creature);
DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me);
}
}
}
@@ -157,11 +157,11 @@ struct boss_curatorAI : public ScriptedAI
AddTimer = 10000;
} else AddTimer -= diff;
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 15)
if (me->GetHealth()*100 / me->GetMaxHealth() <= 15)
{
Enraged = true;
DoCast(m_creature, SPELL_ENRAGE);
DoScriptText(SAY_ENRAGE, m_creature);
DoCast(me, SPELL_ENRAGE);
DoScriptText(SAY_ENRAGE, me);
}
}
@@ -63,17 +63,17 @@ struct boss_maiden_of_virtueAI : public ScriptedAI
void KilledUnit(Unit* Victim)
{
if (urand(0,1) == 0)
DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), m_creature);
DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me);
}
void JustDied(Unit* Killer)
{
DoScriptText(SAY_DEATH, m_creature);
DoScriptText(SAY_DEATH, me);
}
void EnterCombat(Unit *who)
{
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
}
void UpdateAI(const uint32 diff)
@@ -83,20 +83,20 @@ struct boss_maiden_of_virtueAI : public ScriptedAI
if (Enrage_Timer < diff && !Enraged)
{
DoCast(m_creature, SPELL_BERSERK, true);
DoCast(me, SPELL_BERSERK, true);
Enraged = true;
} else Enrage_Timer -= diff;
if (Holyground_Timer <= diff)
{
DoCast(m_creature, SPELL_HOLYGROUND, true); //Triggered so it doesn't interrupt her at all
DoCast(me, SPELL_HOLYGROUND, true); //Triggered so it doesn't interrupt her at all
Holyground_Timer = 3000;
} else Holyground_Timer -= diff;
if (Repentance_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_REPENTANCE);
DoScriptText(RAND(SAY_REPENTANCE1,SAY_REPENTANCE2), m_creature);
DoCast(me->getVictim(), SPELL_REPENTANCE);
DoScriptText(RAND(SAY_REPENTANCE1,SAY_REPENTANCE2), me);
Repentance_Timer = urand(25000,35000); //A little randomness on that spell
} else Repentance_Timer -= diff;
@@ -58,8 +58,8 @@ struct boss_midnightAI : public ScriptedAI
Attumen = 0;
Mount_Timer = 0;
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->SetVisibility(VISIBILITY_ON);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetVisibility(VISIBILITY_ON);
}
void EnterCombat(Unit* who) {}
@@ -68,7 +68,7 @@ struct boss_midnightAI : public ScriptedAI
{
if (Phase == 2)
{
if (Unit *pUnit = Unit::GetUnit(*m_creature, Attumen))
if (Unit *pUnit = Unit::GetUnit(*me, Attumen))
DoScriptText(SAY_MIDNIGHT_KILL, pUnit);
}
}
@@ -78,20 +78,20 @@ struct boss_midnightAI : public ScriptedAI
if (!UpdateVictim())
return;
if (Phase == 1 && (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 95)
if (Phase == 1 && (me->GetHealth()*100)/me->GetMaxHealth() < 95)
{
Phase = 2;
if (Creature* pAttumen = m_creature->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000))
if (Creature* pAttumen = me->SummonCreature(SUMMON_ATTUMEN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30000))
{
Attumen = pAttumen->GetGUID();
pAttumen->AI()->AttackStart(m_creature->getVictim());
SetMidnight(pAttumen, m_creature->GetGUID());
pAttumen->AI()->AttackStart(me->getVictim());
SetMidnight(pAttumen, me->GetGUID());
DoScriptText(RAND(SAY_APPEAR1,SAY_APPEAR2,SAY_APPEAR3), pAttumen);
}
}
else if (Phase == 2 && (m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 25)
else if (Phase == 2 && (me->GetHealth()*100)/me->GetMaxHealth() < 25)
{
if (Unit *pAttumen = Unit::GetUnit(*m_creature, Attumen))
if (Unit *pAttumen = Unit::GetUnit(*me, Attumen))
Mount(pAttumen);
}
else if (Phase == 3)
@@ -101,9 +101,9 @@ struct boss_midnightAI : public ScriptedAI
if (Mount_Timer <= diff)
{
Mount_Timer = 0;
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->GetMotionMaster()->MoveIdle();
if (Unit *pAttumen = Unit::GetUnit(*m_creature, Attumen))
me->SetVisibility(VISIBILITY_OFF);
me->GetMotionMaster()->MoveIdle();
if (Unit *pAttumen = Unit::GetUnit(*me, Attumen))
{
pAttumen->SetDisplayId(MOUNTED_DISPLAYID);
pAttumen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
@@ -126,20 +126,20 @@ struct boss_midnightAI : public ScriptedAI
{
DoScriptText(SAY_MOUNT, pAttumen);
Phase = 3;
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
pAttumen->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
float angle = m_creature->GetAngle(pAttumen);
float distance = m_creature->GetDistance2d(pAttumen);
float newX = m_creature->GetPositionX() + cos(angle)*(distance/2) ;
float newY = m_creature->GetPositionY() + sin(angle)*(distance/2) ;
float angle = me->GetAngle(pAttumen);
float distance = me->GetDistance2d(pAttumen);
float newX = me->GetPositionX() + cos(angle)*(distance/2) ;
float newY = me->GetPositionY() + sin(angle)*(distance/2) ;
float newZ = 50;
//m_creature->Relocate(newX,newY,newZ,angle);
//m_creature->SendMonsterMove(newX, newY, newZ, 0, true, 1000);
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MovePoint(0, newX, newY, newZ);
//me->Relocate(newX,newY,newZ,angle);
//me->SendMonsterMove(newX, newY, newZ, 0, true, 1000);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(0, newX, newY, newZ);
distance += 10;
newX = m_creature->GetPositionX() + cos(angle)*(distance/2) ;
newY = m_creature->GetPositionY() + sin(angle)*(distance/2) ;
newX = me->GetPositionX() + cos(angle)*(distance/2) ;
newY = me->GetPositionY() + sin(angle)*(distance/2) ;
pAttumen->GetMotionMaster()->Clear();
pAttumen->GetMotionMaster()->MovePoint(0, newX, newY, newZ);
//pAttumen->Relocate(newX,newY,newZ,-angle);
@@ -185,13 +185,13 @@ struct boss_attumenAI : public ScriptedAI
void KilledUnit(Unit *victim)
{
DoScriptText(RAND(SAY_KILL1,SAY_KILL2), m_creature);
DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me);
}
void JustDied(Unit *victim)
{
DoScriptText(SAY_DEATH, m_creature);
if (Unit *pMidnight = Unit::GetUnit(*m_creature, Midnight))
DoScriptText(SAY_DEATH, me);
if (Unit *pMidnight = Unit::GetUnit(*me, Midnight))
pMidnight->Kill(pMidnight);
}
@@ -202,15 +202,15 @@ struct boss_attumenAI : public ScriptedAI
if (ResetTimer <= diff)
{
ResetTimer = 0;
Unit *pMidnight = Unit::GetUnit(*m_creature, Midnight);
Unit *pMidnight = Unit::GetUnit(*me, Midnight);
if (pMidnight)
{
pMidnight->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
pMidnight->SetVisibility(VISIBILITY_ON);
}
Midnight = 0;
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->Kill(m_creature);
me->SetVisibility(VISIBILITY_OFF);
me->Kill(me);
}
} else ResetTimer -= diff;
@@ -218,38 +218,38 @@ struct boss_attumenAI : public ScriptedAI
if (!UpdateVictim())
return;
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
return;
if (CleaveTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHADOWCLEAVE);
DoCast(me->getVictim(), SPELL_SHADOWCLEAVE);
CleaveTimer = urand(10000,15000);
} else CleaveTimer -= diff;
if (CurseTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_INTANGIBLE_PRESENCE);
DoCast(me->getVictim(), SPELL_INTANGIBLE_PRESENCE);
CurseTimer = 30000;
} else CurseTimer -= diff;
if (RandomYellTimer <= diff)
{
DoScriptText(RAND(SAY_RANDOM1,SAY_RANDOM2), m_creature);
DoScriptText(RAND(SAY_RANDOM1,SAY_RANDOM2), me);
RandomYellTimer = urand(30000,60000);
} else RandomYellTimer -= diff;
if (m_creature->GetUInt32Value(UNIT_FIELD_DISPLAYID) == MOUNTED_DISPLAYID)
if (me->GetUInt32Value(UNIT_FIELD_DISPLAYID) == MOUNTED_DISPLAYID)
{
if (ChargeTimer <= diff)
{
Unit *pTarget;
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
std::list<HostileReference *> t_list = me->getThreatManager().getThreatList();
std::vector<Unit *> target_list;
for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
if (pTarget && !pTarget->IsWithinDist(m_creature, ATTACK_DISTANCE, false))
pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (pTarget && !pTarget->IsWithinDist(me, ATTACK_DISTANCE, false))
target_list.push_back(pTarget);
pTarget = NULL;
}
@@ -262,13 +262,13 @@ struct boss_attumenAI : public ScriptedAI
}
else
{
if ((m_creature->GetHealth()*100)/m_creature->GetMaxHealth() < 25)
if ((me->GetHealth()*100)/me->GetMaxHealth() < 25)
{
Creature *pMidnight = Unit::GetCreature(*m_creature, Midnight);
Creature *pMidnight = Unit::GetCreature(*me, Midnight);
if (pMidnight && pMidnight->GetTypeId() == TYPEID_UNIT)
{
CAST_AI(boss_midnightAI, (pMidnight->AI()))->Mount(m_creature);
m_creature->SetHealth(pMidnight->GetHealth());
CAST_AI(boss_midnightAI, (pMidnight->AI()))->Mount(me);
me->SetHealth(pMidnight->GetHealth());
DoResetThreat();
}
}
@@ -280,7 +280,7 @@ struct boss_attumenAI : public ScriptedAI
void SpellHit(Unit *source, const SpellEntry *spell)
{
if (spell->Mechanic == MECHANIC_DISARM)
DoScriptText(SAY_DISARMED, m_creature);
DoScriptText(SAY_DISARMED, me);
}
};
@@ -93,7 +93,7 @@ struct boss_moroesAI : public ScriptedAI
Enrage = false;
InVanish = false;
if (m_creature->GetHealth() > 0)
if (me->GetHealth() > 0)
{
SpawnAdds();
}
@@ -114,19 +114,19 @@ struct boss_moroesAI : public ScriptedAI
{
StartEvent();
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
AddsAttack();
DoZoneInCombat();
}
void KilledUnit(Unit* victim)
{
DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), m_creature);
DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2,SAY_KILL_3), me);
}
void JustDied(Unit* victim)
{
DoScriptText(SAY_DEATH, m_creature);
DoScriptText(SAY_DEATH, me);
if (pInstance)
pInstance->SetData(TYPE_MOROES, DONE);
@@ -157,7 +157,7 @@ struct boss_moroesAI : public ScriptedAI
{
uint32 entry = *itr;
pCreature = m_creature->SummonCreature(entry, Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
pCreature = me->SummonCreature(entry, Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
if (pCreature)
{
AddGUID[i] = pCreature->GetGUID();
@@ -169,7 +169,7 @@ struct boss_moroesAI : public ScriptedAI
{
for (uint8 i = 0; i < 4; ++i)
{
Creature *pCreature = m_creature->SummonCreature(AddId[i], Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
Creature *pCreature = me->SummonCreature(AddId[i], Locations[i][0], Locations[i][1], POS_Z, Locations[i][2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000);
if (pCreature)
{
AddGUID[i] = pCreature->GetGUID();
@@ -195,7 +195,7 @@ struct boss_moroesAI : public ScriptedAI
Creature* Temp = NULL;
if (AddGUID[i])
{
Temp = Creature::GetCreature((*m_creature),AddGUID[i]);
Temp = Creature::GetCreature((*me),AddGUID[i]);
if (Temp && Temp->isAlive())
Temp->DisappearAndDie();
}
@@ -209,10 +209,10 @@ struct boss_moroesAI : public ScriptedAI
Creature* Temp = NULL;
if (AddGUID[i])
{
Temp = Creature::GetCreature((*m_creature),AddGUID[i]);
Temp = Creature::GetCreature((*me),AddGUID[i]);
if (Temp && Temp->isAlive())
{
Temp->AI()->AttackStart(m_creature->getVictim());
Temp->AI()->AttackStart(me->getVictim());
DoZoneInCombat(Temp);
} else
EnterEvadeMode();
@@ -231,9 +231,9 @@ struct boss_moroesAI : public ScriptedAI
return;
}
if (!Enrage && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30)
if (!Enrage && me->GetHealth()*100 / me->GetMaxHealth() < 30)
{
DoCast(m_creature, SPELL_FRENZY);
DoCast(me, SPELL_FRENZY);
Enrage = true;
}
@@ -244,10 +244,10 @@ struct boss_moroesAI : public ScriptedAI
Creature* Temp = NULL;
if (AddGUID[i])
{
Temp = Unit::GetCreature((*m_creature),AddGUID[i]);
Temp = Unit::GetCreature((*me),AddGUID[i]);
if (Temp && Temp->isAlive())
if (!Temp->getVictim())
Temp->AI()->AttackStart(m_creature->getVictim());
Temp->AI()->AttackStart(me->getVictim());
}
}
CheckAdds_Timer = 5000;
@@ -258,7 +258,7 @@ struct boss_moroesAI : public ScriptedAI
//Cast Vanish, then Garrote random victim
if (Vanish_Timer <= diff)
{
DoCast(m_creature, SPELL_VANISH);
DoCast(me, SPELL_VANISH);
InVanish = true;
Vanish_Timer = 30000;
Wait_Timer = 5000;
@@ -273,9 +273,9 @@ struct boss_moroesAI : public ScriptedAI
if (Blind_Timer <= diff)
{
std::list<Unit*> pTargets;
SelectTargetList(pTargets, 5, SELECT_TARGET_RANDOM, m_creature->GetMeleeReach()*5, true);
SelectTargetList(pTargets, 5, SELECT_TARGET_RANDOM, me->GetMeleeReach()*5, true);
for (std::list<Unit*>::const_iterator i = pTargets.begin(); i != pTargets.end(); ++i)
if (!m_creature->IsWithinMeleeRange(*i))
if (!me->IsWithinMeleeRange(*i))
{
DoCast(*i, SPELL_BLIND);
break;
@@ -288,7 +288,7 @@ struct boss_moroesAI : public ScriptedAI
{
if (Wait_Timer <= diff)
{
DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2), m_creature);
DoScriptText(RAND(SAY_SPECIAL_1,SAY_SPECIAL_2), me);
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
pTarget->CastSpell(pTarget, SPELL_GARROTE,true);
@@ -328,7 +328,7 @@ struct boss_moroes_guestAI : public ScriptedAI
return;
uint64 MoroesGUID = pInstance->GetData64(DATA_MOROES);
Creature* Moroes = (Unit::GetCreature((*m_creature), MoroesGUID));
Creature* Moroes = (Unit::GetCreature((*me), MoroesGUID));
if (Moroes)
{
for (uint8 i = 0; i < 4; ++i)
@@ -345,12 +345,12 @@ struct boss_moroes_guestAI : public ScriptedAI
uint64 TempGUID = GuestGUID[rand()%4];
if (TempGUID)
{
Unit* pUnit = Unit::GetUnit((*m_creature), TempGUID);
Unit* pUnit = Unit::GetUnit((*me), TempGUID);
if (pUnit && pUnit->isAlive())
return pUnit;
}
return m_creature;
return me;
}
void UpdateAI(const uint32 diff)
@@ -382,7 +382,7 @@ struct boss_baroness_dorothea_millstipeAI : public boss_moroes_guestAI
MindFlay_Timer = 1000;
ShadowWordPain_Timer = 6000;
DoCast(m_creature, SPELL_SHADOWFORM, true);
DoCast(me, SPELL_SHADOWFORM, true);
boss_moroes_guestAI::Reset();
}
@@ -396,7 +396,7 @@ struct boss_baroness_dorothea_millstipeAI : public boss_moroes_guestAI
if (MindFlay_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_MINDFLY);
DoCast(me->getVictim(), SPELL_MINDFLY);
MindFlay_Timer = 12000; // 3 sec channeled
} else MindFlay_Timer -= diff;
@@ -450,20 +450,20 @@ struct boss_baron_rafe_dreugerAI : public boss_moroes_guestAI
if (SealOfCommand_Timer <= diff)
{
DoCast(m_creature, SPELL_SEALOFCOMMAND);
DoCast(me, SPELL_SEALOFCOMMAND);
SealOfCommand_Timer = 32000;
JudgementOfCommand_Timer = 29000;
} else SealOfCommand_Timer -= diff;
if (JudgementOfCommand_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_JUDGEMENTOFCOMMAND);
DoCast(me->getVictim(), SPELL_JUDGEMENTOFCOMMAND);
JudgementOfCommand_Timer = SealOfCommand_Timer + 29000;
} else JudgementOfCommand_Timer -= diff;
if (HammerOfJustice_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_HAMMEROFJUSTICE);
DoCast(me->getVictim(), SPELL_HAMMEROFJUSTICE);
HammerOfJustice_Timer = 12000;
} else HammerOfJustice_Timer -= diff;
}
@@ -505,7 +505,7 @@ struct boss_lady_catriona_von_indiAI : public boss_moroes_guestAI
if (PowerWordShield_Timer <= diff)
{
DoCast(m_creature, SPELL_PWSHIELD);
DoCast(me, SPELL_PWSHIELD);
PowerWordShield_Timer = 15000;
} else PowerWordShield_Timer -= diff;
@@ -519,7 +519,7 @@ struct boss_lady_catriona_von_indiAI : public boss_moroes_guestAI
if (HolyFire_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_HOLYFIRE);
DoCast(me->getVictim(), SPELL_HOLYFIRE);
HolyFire_Timer = 22000;
} else HolyFire_Timer -= diff;
@@ -569,7 +569,7 @@ struct boss_lady_keira_berrybuckAI : public boss_moroes_guestAI
if (DivineShield_Timer <= diff)
{
DoCast(m_creature, SPELL_DIVINESHIELD);
DoCast(me, SPELL_DIVINESHIELD);
DivineShield_Timer = 31000;
} else DivineShield_Timer -= diff;
@@ -632,19 +632,19 @@ struct boss_lord_robin_darisAI : public boss_moroes_guestAI
if (Hamstring_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_HAMSTRING);
DoCast(me->getVictim(), SPELL_HAMSTRING);
Hamstring_Timer = 12000;
} else Hamstring_Timer -= diff;
if (MortalStrike_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_MORTALSTRIKE);
DoCast(me->getVictim(), SPELL_MORTALSTRIKE);
MortalStrike_Timer = 18000;
} else MortalStrike_Timer -= diff;
if (WhirlWind_Timer <= diff)
{
DoCast(m_creature, SPELL_WHIRLWIND);
DoCast(me, SPELL_WHIRLWIND);
WhirlWind_Timer = 21000;
} else WhirlWind_Timer -= diff;
}
@@ -684,25 +684,25 @@ struct boss_lord_crispin_ferenceAI : public boss_moroes_guestAI
if (Disarm_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_DISARM);
DoCast(me->getVictim(), SPELL_DISARM);
Disarm_Timer = 12000;
} else Disarm_Timer -= diff;
if (HeroicStrike_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_HEROICSTRIKE);
DoCast(me->getVictim(), SPELL_HEROICSTRIKE);
HeroicStrike_Timer = 10000;
} else HeroicStrike_Timer -= diff;
if (ShieldBash_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHIELDBASH);
DoCast(me->getVictim(), SPELL_SHIELDBASH);
ShieldBash_Timer = 13000;
} else ShieldBash_Timer -= diff;
if (ShieldWall_Timer <= diff)
{
DoCast(m_creature, SPELL_SHIELDWALL);
DoCast(me, SPELL_SHIELDWALL);
ShieldWall_Timer = 21000;
} else ShieldWall_Timer -= diff;
}
@@ -135,7 +135,7 @@ struct boss_netherspiteAI : public ScriptedAI
pos[BLUE_PORTAL] = (r>1 ? 1: 2); // Blue Portal not on the left side (0)
for (int i=0; i<3; ++i)
if (Creature *portal = m_creature->SummonCreature(PortalID[i],PortalCoord[pos[i]][0],PortalCoord[pos[i]][1],PortalCoord[pos[i]][2],0,TEMPSUMMON_TIMED_DESPAWN,60000))
if (Creature *portal = me->SummonCreature(PortalID[i],PortalCoord[pos[i]][0],PortalCoord[pos[i]][1],PortalCoord[pos[i]][2],0,TEMPSUMMON_TIMED_DESPAWN,60000))
{
PortalGUID[i] = portal->GetGUID();
portal->AddAura(PortalVisual[i], portal);
@@ -146,9 +146,9 @@ struct boss_netherspiteAI : public ScriptedAI
{
for (int i=0; i<3; ++i)
{
if (Creature *portal = Unit::GetCreature(*m_creature, PortalGUID[i]))
if (Creature *portal = Unit::GetCreature(*me, PortalGUID[i]))
portal->DisappearAndDie();
if (Creature *portal = Unit::GetCreature(*m_creature, BeamerGUID[i]))
if (Creature *portal = Unit::GetCreature(*me, BeamerGUID[i]))
portal->DisappearAndDie();
PortalGUID[i] = 0;
BeamTarget[i] = 0;
@@ -158,14 +158,14 @@ struct boss_netherspiteAI : public ScriptedAI
void UpdatePortals() // Here we handle the beams' behavior
{
for (int j=0; j<3; ++j) // j = color
if (Creature *portal = Unit::GetCreature(*m_creature, PortalGUID[j]))
if (Creature *portal = Unit::GetCreature(*me, PortalGUID[j]))
{
// the one who's been casted upon before
Unit *current = Unit::GetUnit(*portal, BeamTarget[j]);
// temporary store for the best suitable beam reciever
Unit *pTarget = m_creature;
Unit *pTarget = me;
if (Map* map = m_creature->GetMap())
if (Map* map = me->GetMap())
{
Map::PlayerList const& players = map->GetPlayers();
@@ -178,7 +178,7 @@ struct boss_netherspiteAI : public ScriptedAI
&& !p->HasAura(PlayerDebuff[j],0) // not exhausted
&& !p->HasAura(PlayerBuff[(j+1)%3],0) // not on another beam
&& !p->HasAura(PlayerBuff[(j+2)%3],0)
&& IsBetween(m_creature, p, portal)) // on the beam
&& IsBetween(me, p, portal)) // on the beam
pTarget = p;
}
}
@@ -207,41 +207,41 @@ struct boss_netherspiteAI : public ScriptedAI
}
}
// aggro target if Red Beam
if (j == RED_PORTAL && m_creature->getVictim() != pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
m_creature->getThreatManager().addThreat(pTarget, 100000.0f+DoGetThreat(m_creature->getVictim()));
if (j == RED_PORTAL && me->getVictim() != pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
me->getThreatManager().addThreat(pTarget, 100000.0f+DoGetThreat(me->getVictim()));
}
}
void SwitchToPortalPhase()
{
m_creature->RemoveAurasDueToSpell(SPELL_BANISH_ROOT);
m_creature->RemoveAurasDueToSpell(SPELL_BANISH_VISUAL);
me->RemoveAurasDueToSpell(SPELL_BANISH_ROOT);
me->RemoveAurasDueToSpell(SPELL_BANISH_VISUAL);
SummonPortals();
PhaseTimer = 60000;
PortalPhase = true;
PortalTimer = 10000;
EmpowermentTimer = 10000;
DoScriptText(EMOTE_PHASE_PORTAL,m_creature);
DoScriptText(EMOTE_PHASE_PORTAL,me);
}
void SwitchToBanishPhase()
{
m_creature->RemoveAurasDueToSpell(SPELL_EMPOWERMENT);
m_creature->RemoveAurasDueToSpell(SPELL_NETHERBURN_AURA);
DoCast(m_creature, SPELL_BANISH_VISUAL, true);
DoCast(m_creature, SPELL_BANISH_ROOT, true);
me->RemoveAurasDueToSpell(SPELL_EMPOWERMENT);
me->RemoveAurasDueToSpell(SPELL_NETHERBURN_AURA);
DoCast(me, SPELL_BANISH_VISUAL, true);
DoCast(me, SPELL_BANISH_ROOT, true);
DestroyPortals();
PhaseTimer = 30000;
PortalPhase = false;
DoScriptText(EMOTE_PHASE_BANISH,m_creature);
DoScriptText(EMOTE_PHASE_BANISH,me);
for (int i=0; i<3; ++i)
m_creature->RemoveAurasDueToSpell(NetherBuff[i]);
me->RemoveAurasDueToSpell(NetherBuff[i]);
}
void HandleDoors(bool open) // Massive Door switcher
{
if (GameObject *Door = GameObject::GetGameObject(*m_creature, pInstance ? pInstance->GetData64(DATA_GO_MASSIVE_DOOR) : 0))
if (GameObject *Door = GameObject::GetGameObject(*me, pInstance ? pInstance->GetData64(DATA_GO_MASSIVE_DOOR) : 0))
Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
}
@@ -272,8 +272,8 @@ struct boss_netherspiteAI : public ScriptedAI
// NetherInfusion Berserk
if (!Berserk && NetherInfusionTimer <= diff)
{
m_creature->AddAura(SPELL_NETHER_INFUSION, m_creature);
DoCast(m_creature, SPELL_NETHERSPITE_ROAR);
me->AddAura(SPELL_NETHER_INFUSION, me);
DoCast(me, SPELL_NETHERSPITE_ROAR);
Berserk = true;
} else NetherInfusionTimer -= diff;
@@ -289,14 +289,14 @@ struct boss_netherspiteAI : public ScriptedAI
// Empowerment & Nether Burn
if (EmpowermentTimer <= diff)
{
DoCast(m_creature, SPELL_EMPOWERMENT);
m_creature->AddAura(SPELL_NETHERBURN_AURA, m_creature);
DoCast(me, SPELL_EMPOWERMENT);
me->AddAura(SPELL_NETHERBURN_AURA, me);
EmpowermentTimer = 90000;
} else EmpowermentTimer -= diff;
if (PhaseTimer <= diff)
{
if (!m_creature->IsNonMeleeSpellCasted(false))
if (!me->IsNonMeleeSpellCasted(false))
{
SwitchToBanishPhase();
return;
@@ -315,7 +315,7 @@ struct boss_netherspiteAI : public ScriptedAI
if (PhaseTimer <= diff)
{
if (!m_creature->IsNonMeleeSpellCasted(false))
if (!me->IsNonMeleeSpellCasted(false))
{
SwitchToPortalPhase();
return;
@@ -108,15 +108,15 @@ struct boss_nightbaneAI : public ScriptedAI
FlyCount = 0;
MovePhase = 0;
m_creature->SetSpeed(MOVE_RUN, 2.0f);
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
m_creature->setActive(true);
me->SetSpeed(MOVE_RUN, 2.0f);
me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
me->setActive(true);
if (pInstance)
{
if (pInstance->GetData(TYPE_NIGHTBANE) == DONE || pInstance->GetData(TYPE_NIGHTBANE) == IN_PROGRESS)
m_creature->DisappearAndDie();
me->DisappearAndDie();
else
pInstance->SetData(TYPE_NIGHTBANE, NOT_STARTED);
}
@@ -128,8 +128,8 @@ struct boss_nightbaneAI : public ScriptedAI
if (!Intro)
{
m_creature->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0);
m_creature->GetMotionMaster()->MoveTargetedHome();
me->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0);
me->GetMotionMaster()->MoveTargetedHome();
}
}
@@ -148,7 +148,7 @@ struct boss_nightbaneAI : public ScriptedAI
pInstance->SetData(TYPE_NIGHTBANE, IN_PROGRESS);
HandleTerraceDoors(false);
m_creature->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL);
me->MonsterYell(YELL_AGGRO, LANG_UNIVERSAL, NULL);
}
void AttackStart(Unit* who)
@@ -181,7 +181,7 @@ struct boss_nightbaneAI : public ScriptedAI
if (id >= 8)
{
Intro = false;
m_creature->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0);
me->SetHomePosition(IntroWay[7][0],IntroWay[7][1],IntroWay[7][2],0);
return;
}
@@ -192,7 +192,7 @@ struct boss_nightbaneAI : public ScriptedAI
{
if (id == 0)
{
m_creature->MonsterTextEmote(EMOTE_BREATH, 0, true);
me->MonsterTextEmote(EMOTE_BREATH, 0, true);
Flying = false;
Phase = 2;
return;
@@ -219,18 +219,18 @@ struct boss_nightbaneAI : public ScriptedAI
void JustSummoned(Creature *summoned)
{
summoned->AI()->AttackStart(m_creature->getVictim());
summoned->AI()->AttackStart(me->getVictim());
}
void TakeOff()
{
m_creature->MonsterYell(YELL_FLY_PHASE, LANG_UNIVERSAL, NULL);
me->MonsterYell(YELL_FLY_PHASE, LANG_UNIVERSAL, NULL);
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
(*m_creature).GetMotionMaster()->Clear(false);
(*m_creature).GetMotionMaster()->MovePoint(0,IntroWay[2][0],IntroWay[2][1],IntroWay[2][2]);
me->InterruptSpell(CURRENT_GENERIC_SPELL);
me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
(*me).GetMotionMaster()->Clear(false);
(*me).GetMotionMaster()->MovePoint(0,IntroWay[2][0],IntroWay[2][1],IntroWay[2][2]);
Flying = true;
@@ -251,13 +251,13 @@ struct boss_nightbaneAI : public ScriptedAI
{
if (MovePhase >= 7)
{
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
m_creature->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]);
me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
me->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]);
}
else
{
m_creature->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]);
me->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]);
++MovePhase;
}
}
@@ -265,13 +265,13 @@ struct boss_nightbaneAI : public ScriptedAI
{
if (MovePhase >= 7)
{
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
m_creature->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]);
me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
me->GetMotionMaster()->MovePoint(8,IntroWay[7][0],IntroWay[7][1],IntroWay[7][2]);
}
else
{
m_creature->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]);
me->GetMotionMaster()->MovePoint(MovePhase,IntroWay[MovePhase][0],IntroWay[MovePhase][1],IntroWay[MovePhase][2]);
++MovePhase;
}
}
@@ -291,19 +291,19 @@ struct boss_nightbaneAI : public ScriptedAI
{
if (Movement)
{
DoStartMovement(m_creature->getVictim());
DoStartMovement(me->getVictim());
Movement = false;
}
if (BellowingRoarTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_BELLOWING_ROAR);
DoCast(me->getVictim(), SPELL_BELLOWING_ROAR);
BellowingRoarTimer = urand(30000,40000);
} else BellowingRoarTimer -= diff;
if (SmolderingBreathTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SMOLDERING_BREATH);
DoCast(me->getVictim(), SPELL_SMOLDERING_BREATH);
SmolderingBreathTimer = 20000;
} else SmolderingBreathTimer -= diff;
@@ -317,7 +317,7 @@ struct boss_nightbaneAI : public ScriptedAI
if (TailSweepTimer <= diff)
{
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
if (!m_creature->HasInArc(M_PI, pTarget))
if (!me->HasInArc(M_PI, pTarget))
DoCast(pTarget, SPELL_TAIL_SWEEP);
TailSweepTimer = 15000;
} else TailSweepTimer -= diff;
@@ -330,7 +330,7 @@ struct boss_nightbaneAI : public ScriptedAI
} else SearingCindersTimer -= diff;
uint32 Prozent;
Prozent = (m_creature->GetHealth()*100) / m_creature->GetMaxHealth();
Prozent = (me->GetHealth()*100) / me->GetMaxHealth();
if (Prozent < 75 && FlyCount == 0) // first take off 75%
TakeOff();
@@ -353,14 +353,14 @@ struct boss_nightbaneAI : public ScriptedAI
{
for (uint8 i = 0; i <= 3; ++i)
{
DoCast(m_creature->getVictim(), SPELL_SUMMON_SKELETON);
DoCast(me->getVictim(), SPELL_SUMMON_SKELETON);
Skeletons = true;
}
}
if (RainofBonesTimer < diff && !RainBones) // only once at the beginning of phase 2
{
DoCast(m_creature->getVictim(), SPELL_RAIN_OF_BONES);
DoCast(me->getVictim(), SPELL_RAIN_OF_BONES);
RainBones = true;
SmokingBlastTimer = 20000;
} else RainofBonesTimer -= diff;
@@ -377,7 +377,7 @@ struct boss_nightbaneAI : public ScriptedAI
{
if (SmokingBlastTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SMOKING_BLAST);
DoCast(me->getVictim(), SPELL_SMOKING_BLAST);
SmokingBlastTimer = 1500; //timer wrong
} else SmokingBlastTimer -= diff;
}
@@ -391,10 +391,10 @@ struct boss_nightbaneAI : public ScriptedAI
if (FlyTimer <= diff) //landing
{
m_creature->MonsterYell(RAND(*YELL_LAND_PHASE_1,*YELL_LAND_PHASE_2), LANG_UNIVERSAL, NULL);
me->MonsterYell(RAND(*YELL_LAND_PHASE_1,*YELL_LAND_PHASE_2), LANG_UNIVERSAL, NULL);
m_creature->GetMotionMaster()->Clear(false);
m_creature->GetMotionMaster()->MovePoint(3,IntroWay[3][0],IntroWay[3][1],IntroWay[3][2]);
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MovePoint(3,IntroWay[3][0],IntroWay[3][1],IntroWay[3][2]);
Flying = true;
} else FlyTimer -= diff;
@@ -113,7 +113,7 @@ struct netherspite_infernalAI : public ScriptedAI
if (HellfireTimer)
if (HellfireTimer <= diff)
{
DoCast(m_creature, SPELL_HELLFIRE);
DoCast(me, SPELL_HELLFIRE);
HellfireTimer = 0;
}
else HellfireTimer -= diff;
@@ -128,7 +128,7 @@ struct netherspite_infernalAI : public ScriptedAI
void KilledUnit(Unit *who)
{
Unit *pMalchezaar = Unit::GetUnit(*m_creature, malchezaar);
Unit *pMalchezaar = Unit::GetUnit(*me, malchezaar);
if (pMalchezaar)
CAST_CRE(pMalchezaar)->AI()->KilledUnit(who);
}
@@ -137,8 +137,8 @@ struct netherspite_infernalAI : public ScriptedAI
{
if (spell->Id == SPELL_INFERNAL_RELAY)
{
m_creature->SetDisplayId(m_creature->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID));
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetDisplayId(me->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID));
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
HellfireTimer = 4000;
CleanupTimer = 170000;
}
@@ -212,12 +212,12 @@ struct boss_malchezaarAI : public ScriptedAI
void KilledUnit(Unit *victim)
{
DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), m_creature);
DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me);
}
void JustDied(Unit *victim)
{
DoScriptText(SAY_DEATH, m_creature);
DoScriptText(SAY_DEATH, me);
AxesCleanup();
ClearWeapons();
@@ -233,7 +233,7 @@ struct boss_malchezaarAI : public ScriptedAI
void EnterCombat(Unit *who)
{
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
if (pInstance)
pInstance->HandleGameObject(pInstance->GetData64(DATA_GO_NETHER_DOOR), false); // Open the door leading further in
@@ -243,7 +243,7 @@ struct boss_malchezaarAI : public ScriptedAI
{
//Infernal Cleanup
for (std::vector<uint64>::const_iterator itr = infernals.begin(); itr != infernals.end(); ++itr)
if (Unit *pInfernal = Unit::GetUnit(*m_creature, *itr))
if (Unit *pInfernal = Unit::GetUnit(*me, *itr))
if (pInfernal->isAlive())
{
pInfernal->SetVisibility(VISIBILITY_OFF);
@@ -257,7 +257,7 @@ struct boss_malchezaarAI : public ScriptedAI
{
for (uint8 i = 0; i < 2; ++i)
{
Unit *axe = Unit::GetUnit(*m_creature, axes[i]);
Unit *axe = Unit::GetUnit(*me, axes[i]);
if (axe && axe->isAlive())
axe->Kill(axe);
axes[i] = 0;
@@ -269,10 +269,10 @@ struct boss_malchezaarAI : public ScriptedAI
SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE);
//damage
const CreatureInfo *cinfo = m_creature->GetCreatureInfo();
m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg);
m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg);
m_creature->UpdateDamagePhysical(BASE_ATTACK);
const CreatureInfo *cinfo = me->GetCreatureInfo();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg);
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg);
me->UpdateDamagePhysical(BASE_ATTACK);
}
void EnfeebleHealthEffect()
@@ -281,7 +281,7 @@ struct boss_malchezaarAI : public ScriptedAI
if (!info)
return;
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
std::list<HostileReference *> t_list = me->getThreatManager().getThreatList();
std::vector<Unit *> targets;
if (!t_list.size())
@@ -291,7 +291,7 @@ struct boss_malchezaarAI : public ScriptedAI
std::list<HostileReference *>::const_iterator itr = t_list.begin();
std::advance(itr, 1);
for (; itr != t_list.end(); ++itr) //store the threat list in a different container
if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
if (pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER)
targets.push_back(pTarget);
@@ -306,7 +306,7 @@ struct boss_malchezaarAI : public ScriptedAI
enfeeble_targets[i] = pTarget->GetGUID();
enfeeble_health[i] = pTarget->GetHealth();
pTarget->CastSpell(pTarget, SPELL_ENFEEBLE, true, 0, 0, m_creature->GetGUID());
pTarget->CastSpell(pTarget, SPELL_ENFEEBLE, true, 0, 0, me->GetGUID());
pTarget->SetHealth(1);
}
}
@@ -315,7 +315,7 @@ struct boss_malchezaarAI : public ScriptedAI
{
for (uint8 i = 0; i < 5; ++i)
{
Unit *pTarget = Unit::GetUnit(*m_creature, enfeeble_targets[i]);
Unit *pTarget = Unit::GetUnit(*me, enfeeble_targets[i]);
if (pTarget && pTarget->isAlive())
pTarget->SetHealth(enfeeble_health[i]);
enfeeble_targets[i] = 0;
@@ -327,7 +327,7 @@ struct boss_malchezaarAI : public ScriptedAI
{
InfernalPoint *point = NULL;
Position pos;
if ((m_creature->GetMapId() != 532) || positions.empty())
if ((me->GetMapId() != 532) || positions.empty())
me->GetRandomNearPosition(pos, 60);
else
{
@@ -337,21 +337,21 @@ struct boss_malchezaarAI : public ScriptedAI
pos.Relocate(point->x, point->y, INFERNAL_Z);
}
Creature *Infernal = m_creature->SummonCreature(NETHERSPITE_INFERNAL, pos, TEMPSUMMON_TIMED_DESPAWN, 180000);
Creature *Infernal = me->SummonCreature(NETHERSPITE_INFERNAL, pos, TEMPSUMMON_TIMED_DESPAWN, 180000);
if (Infernal)
{
Infernal->SetDisplayId(INFERNAL_MODEL_INVISIBLE);
Infernal->setFaction(m_creature->getFaction());
Infernal->setFaction(me->getFaction());
if (point)
CAST_AI(netherspite_infernalAI, Infernal->AI())->point=point;
CAST_AI(netherspite_infernalAI, Infernal->AI())->malchezaar=m_creature->GetGUID();
CAST_AI(netherspite_infernalAI, Infernal->AI())->malchezaar=me->GetGUID();
infernals.push_back(Infernal->GetGUID());
DoCast(Infernal, SPELL_INFERNAL_RELAY);
}
DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), m_creature);
DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me);
}
void UpdateAI(const uint32 diff)
@@ -365,50 +365,50 @@ struct boss_malchezaarAI : public ScriptedAI
EnfeebleResetTimer = 0;
} else EnfeebleResetTimer -= diff;
if (m_creature->hasUnitState(UNIT_STAT_STUNNED)) // While shifting to phase 2 malchezaar stuns himself
if (me->hasUnitState(UNIT_STAT_STUNNED)) // While shifting to phase 2 malchezaar stuns himself
return;
if (m_creature->GetUInt64Value(UNIT_FIELD_TARGET) != m_creature->getVictim()->GetGUID())
m_creature->SetUInt64Value(UNIT_FIELD_TARGET, m_creature->getVictim()->GetGUID());
if (me->GetUInt64Value(UNIT_FIELD_TARGET) != me->getVictim()->GetGUID())
me->SetUInt64Value(UNIT_FIELD_TARGET, me->getVictim()->GetGUID());
if (phase == 1)
{
if ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 60)
if ((me->GetHealth()*100) / me->GetMaxHealth() < 60)
{
m_creature->InterruptNonMeleeSpells(false);
me->InterruptNonMeleeSpells(false);
phase = 2;
//animation
DoCast(m_creature, SPELL_EQUIP_AXES);
DoCast(me, SPELL_EQUIP_AXES);
//text
DoScriptText(SAY_AXE_TOSS1, m_creature);
DoScriptText(SAY_AXE_TOSS1, me);
//passive thrash aura
DoCast(m_creature, SPELL_THRASH_AURA, true);
DoCast(me, SPELL_THRASH_AURA, true);
//models
SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE);
//damage
const CreatureInfo *cinfo = m_creature->GetCreatureInfo();
m_creature->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg);
m_creature->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg);
m_creature->UpdateDamagePhysical(BASE_ATTACK);
const CreatureInfo *cinfo = me->GetCreatureInfo();
me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg);
me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg);
me->UpdateDamagePhysical(BASE_ATTACK);
m_creature->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg);
m_creature->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg);
me->SetBaseWeaponDamage(OFF_ATTACK, MINDAMAGE, cinfo->mindmg);
me->SetBaseWeaponDamage(OFF_ATTACK, MAXDAMAGE, cinfo->maxdmg);
//Sigh, updating only works on main attack, do it manually ....
m_creature->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg);
m_creature->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg);
me->SetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE, cinfo->mindmg);
me->SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, cinfo->maxdmg);
m_creature->SetAttackTime(OFF_ATTACK, (m_creature->GetAttackTime(BASE_ATTACK)*150)/100);
me->SetAttackTime(OFF_ATTACK, (me->GetAttackTime(BASE_ATTACK)*150)/100);
}
}
else if (phase == 2)
{
if ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 30)
if ((me->GetHealth()*100) / me->GetMaxHealth() < 30)
{
InfernalTimer = 15000;
@@ -417,18 +417,18 @@ struct boss_malchezaarAI : public ScriptedAI
ClearWeapons();
//remove thrash
m_creature->RemoveAurasDueToSpell(SPELL_THRASH_AURA);
me->RemoveAurasDueToSpell(SPELL_THRASH_AURA);
DoScriptText(SAY_AXE_TOSS2, m_creature);
DoScriptText(SAY_AXE_TOSS2, me);
Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
for (uint8 i = 0; i < 2; ++i)
{
Creature *axe = m_creature->SummonCreature(MALCHEZARS_AXE, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000);
Creature *axe = me->SummonCreature(MALCHEZARS_AXE, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000);
if (axe)
{
axe->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
axe->setFaction(m_creature->getFaction());
axe->setFaction(me->getFaction());
axes[i] = axe->GetGUID();
if (pTarget)
{
@@ -448,14 +448,14 @@ struct boss_malchezaarAI : public ScriptedAI
if (SunderArmorTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SUNDER_ARMOR);
DoCast(me->getVictim(), SPELL_SUNDER_ARMOR);
SunderArmorTimer = urand(10000,18000);
} else SunderArmorTimer -= diff;
if (Cleave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = urand(6000,12000);
} else Cleave_Timer -= diff;
@@ -470,7 +470,7 @@ struct boss_malchezaarAI : public ScriptedAI
{
for (uint8 i = 0; i < 2; ++i)
{
if (Unit *axe = Unit::GetUnit(*m_creature, axes[i]))
if (Unit *axe = Unit::GetUnit(*me, axes[i]))
{
if (axe->getVictim())
DoModifyThreatPercent(axe->getVictim(), -100);
@@ -500,7 +500,7 @@ struct boss_malchezaarAI : public ScriptedAI
if (ShadowNovaTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHADOWNOVA);
DoCast(me->getVictim(), SPELL_SHADOWNOVA);
ShadowNovaTimer = phase == 3 ? 31000 : uint32(-1);
} else ShadowNovaTimer -= diff;
@@ -510,7 +510,7 @@ struct boss_malchezaarAI : public ScriptedAI
{
Unit *pTarget = NULL;
if (phase == 1)
pTarget = m_creature->getVictim(); // the tank
pTarget = me->getVictim(); // the tank
else // anyone but the tank
pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
@@ -540,19 +540,19 @@ struct boss_malchezaarAI : public ScriptedAI
void DoMeleeAttacksIfReady()
{
if (m_creature->IsWithinMeleeRange(m_creature->getVictim()) && !m_creature->IsNonMeleeSpellCasted(false))
if (me->IsWithinMeleeRange(me->getVictim()) && !me->IsNonMeleeSpellCasted(false))
{
//Check for base attack
if (m_creature->isAttackReady() && m_creature->getVictim())
if (me->isAttackReady() && me->getVictim())
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
me->AttackerStateUpdate(me->getVictim());
me->resetAttackTimer();
}
//Check for offhand attack
if (m_creature->isAttackReady(OFF_ATTACK) && m_creature->getVictim())
if (me->isAttackReady(OFF_ATTACK) && me->getVictim())
{
m_creature->AttackerStateUpdate(m_creature->getVictim(), OFF_ATTACK);
m_creature->resetAttackTimer(OFF_ATTACK);
me->AttackerStateUpdate(me->getVictim(), OFF_ATTACK);
me->resetAttackTimer(OFF_ATTACK);
}
}
}
@@ -572,10 +572,10 @@ struct boss_malchezaarAI : public ScriptedAI
void netherspite_infernalAI::Cleanup()
{
Unit *pMalchezaar = Unit::GetUnit(*m_creature, malchezaar);
Unit *pMalchezaar = Unit::GetUnit(*me, malchezaar);
if (pMalchezaar && pMalchezaar->isAlive())
CAST_AI(boss_malchezaarAI, CAST_CRE(pMalchezaar)->AI())->Cleanup(m_creature, point);
CAST_AI(boss_malchezaarAI, CAST_CRE(pMalchezaar)->AI())->Cleanup(me, point);
}
CreatureAI* GetAI_netherspite_infernal(Creature* pCreature)
@@ -147,12 +147,12 @@ struct boss_aranAI : public ScriptedAI
void KilledUnit(Unit *victim)
{
DoScriptText(RAND(SAY_KILL1,SAY_KILL2), m_creature);
DoScriptText(RAND(SAY_KILL1,SAY_KILL2), me);
}
void JustDied(Unit *victim)
{
DoScriptText(SAY_DEATH, m_creature);
DoScriptText(SAY_DEATH, me);
if (pInstance)
{
@@ -163,7 +163,7 @@ struct boss_aranAI : public ScriptedAI
void EnterCombat(Unit *who)
{
DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), m_creature);
DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me);
if (pInstance)
{
@@ -175,7 +175,7 @@ struct boss_aranAI : public ScriptedAI
void FlameWreathEffect()
{
std::vector<Unit*> targets;
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
std::list<HostileReference *> t_list = me->getThreatManager().getThreatList();
if (!t_list.size())
return;
@@ -183,7 +183,7 @@ struct boss_aranAI : public ScriptedAI
//store the threat list in a different container
for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid());
//only on alive players
if (pTarget && pTarget->isAlive() && pTarget->GetTypeId() == TYPEID_PLAYER)
targets.push_back(pTarget);
@@ -246,19 +246,19 @@ struct boss_aranAI : public ScriptedAI
else FrostCooldown = 0;
}
if (!Drinking && m_creature->GetMaxPower(POWER_MANA) && (m_creature->GetPower(POWER_MANA)*100 / m_creature->GetMaxPower(POWER_MANA)) < 20)
if (!Drinking && me->GetMaxPower(POWER_MANA) && (me->GetPower(POWER_MANA)*100 / me->GetMaxPower(POWER_MANA)) < 20)
{
Drinking = true;
m_creature->InterruptNonMeleeSpells(false);
me->InterruptNonMeleeSpells(false);
DoScriptText(SAY_DRINK, m_creature);
DoScriptText(SAY_DRINK, me);
if (!DrinkInturrupted)
{
DoCast(m_creature, SPELL_MASS_POLY, true);
DoCast(m_creature, SPELL_CONJURE, false);
DoCast(m_creature, SPELL_DRINK, false);
m_creature->SetStandState(UNIT_STAND_STATE_SIT);
DoCast(me, SPELL_MASS_POLY, true);
DoCast(me, SPELL_CONJURE, false);
DoCast(me, SPELL_DRINK, false);
me->SetStandState(UNIT_STAND_STATE_SIT);
DrinkInturruptTimer = 10000;
}
}
@@ -267,10 +267,10 @@ struct boss_aranAI : public ScriptedAI
if (Drinking && DrinkInturrupted)
{
Drinking = false;
m_creature->RemoveAurasDueToSpell(SPELL_DRINK);
m_creature->SetStandState(UNIT_STAND_STATE_STAND);
m_creature->SetPower(POWER_MANA, m_creature->GetMaxPower(POWER_MANA)-32000);
DoCast(m_creature, SPELL_POTION, false);
me->RemoveAurasDueToSpell(SPELL_DRINK);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetPower(POWER_MANA, me->GetMaxPower(POWER_MANA)-32000);
DoCast(me, SPELL_POTION, false);
}
//Drink Inturrupt Timer
@@ -279,9 +279,9 @@ struct boss_aranAI : public ScriptedAI
DrinkInturruptTimer -= diff;
else
{
m_creature->SetStandState(UNIT_STAND_STATE_STAND);
DoCast(m_creature, SPELL_POTION, true);
DoCast(m_creature, SPELL_AOE_PYROBLAST, false);
me->SetStandState(UNIT_STAND_STATE_STAND);
DoCast(me, SPELL_POTION, true);
DoCast(me, SPELL_AOE_PYROBLAST, false);
DrinkInturrupted = true;
Drinking = false;
}
@@ -293,7 +293,7 @@ struct boss_aranAI : public ScriptedAI
//Normal casts
if (NormalCastTimer <= diff)
{
if (!m_creature->IsNonMeleeSpellCasted(false))
if (!me->IsNonMeleeSpellCasted(false))
{
Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true);
if (!pTarget)
@@ -334,7 +334,7 @@ struct boss_aranAI : public ScriptedAI
switch (urand(0,1))
{
case 0:
DoCast(m_creature, SPELL_AOE_CS);
DoCast(me, SPELL_AOE_CS);
break;
case 1:
if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
@@ -369,16 +369,16 @@ struct boss_aranAI : public ScriptedAI
switch (LastSuperSpell)
{
case SUPER_AE:
DoScriptText(RAND(SAY_EXPLOSION1,SAY_EXPLOSION2), m_creature);
DoScriptText(RAND(SAY_EXPLOSION1,SAY_EXPLOSION2), me);
DoCast(m_creature, SPELL_BLINK_CENTER, true);
DoCast(m_creature, SPELL_PLAYERPULL, true);
DoCast(m_creature, SPELL_MASSSLOW, true);
DoCast(m_creature, SPELL_AEXPLOSION, false);
DoCast(me, SPELL_BLINK_CENTER, true);
DoCast(me, SPELL_PLAYERPULL, true);
DoCast(me, SPELL_MASSSLOW, true);
DoCast(me, SPELL_AEXPLOSION, false);
break;
case SUPER_FLAME:
DoScriptText(RAND(SAY_FLAMEWREATH1,SAY_FLAMEWREATH2), m_creature);
DoScriptText(RAND(SAY_FLAMEWREATH1,SAY_FLAMEWREATH2), me);
FlameWreathTimer = 20000;
FlameWreathCheckTime = 500;
@@ -391,11 +391,11 @@ struct boss_aranAI : public ScriptedAI
break;
case SUPER_BLIZZARD:
DoScriptText(RAND(SAY_BLIZZARD1,SAY_BLIZZARD2), m_creature);
DoScriptText(RAND(SAY_BLIZZARD1,SAY_BLIZZARD2), me);
if (Creature* pSpawn = m_creature->SummonCreature(CREATURE_ARAN_BLIZZARD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 25000))
if (Creature* pSpawn = me->SummonCreature(CREATURE_ARAN_BLIZZARD, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 25000))
{
pSpawn->setFaction(m_creature->getFaction());
pSpawn->setFaction(me->getFaction());
pSpawn->CastSpell(pSpawn, SPELL_CIRCULAR_BLIZZARD, false);
}
break;
@@ -404,34 +404,34 @@ struct boss_aranAI : public ScriptedAI
SuperCastTimer = urand(35000,40000);
} else SuperCastTimer -= diff;
if (!ElementalsSpawned && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 40)
if (!ElementalsSpawned && me->GetHealth()*100 / me->GetMaxHealth() < 40)
{
ElementalsSpawned = true;
for (uint32 i = 0; i < 4; ++i)
{
if (Creature* pUnit = m_creature->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000))
if (Creature* pUnit = me->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000))
{
pUnit->Attack(m_creature->getVictim(), true);
pUnit->setFaction(m_creature->getFaction());
pUnit->Attack(me->getVictim(), true);
pUnit->setFaction(me->getFaction());
}
}
DoScriptText(SAY_ELEMENTALS, m_creature);
DoScriptText(SAY_ELEMENTALS, me);
}
if (BerserkTimer <= diff)
{
for (uint32 i = 0; i < 5; ++i)
{
if (Creature* pUnit = m_creature->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
if (Creature* pUnit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
{
pUnit->Attack(m_creature->getVictim(), true);
pUnit->setFaction(m_creature->getFaction());
pUnit->Attack(me->getVictim(), true);
pUnit->setFaction(me->getFaction());
}
}
DoScriptText(SAY_TIMEOVER, m_creature);
DoScriptText(SAY_TIMEOVER, me);
BerserkTimer = 60000;
} else BerserkTimer -= diff;
@@ -450,10 +450,10 @@ struct boss_aranAI : public ScriptedAI
if (!FlameWreathTarget[i])
continue;
Unit* pUnit = Unit::GetUnit(*m_creature, FlameWreathTarget[i]);
Unit* pUnit = Unit::GetUnit(*me, FlameWreathTarget[i]);
if (pUnit && !pUnit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3))
{
pUnit->CastSpell(pUnit, 20476, true, 0, 0, m_creature->GetGUID());
pUnit->CastSpell(pUnit, 20476, true, 0, 0, me->GetGUID());
pUnit->CastSpell(pUnit, 11027, true);
FlameWreathTarget[i] = 0;
}
@@ -477,11 +477,11 @@ struct boss_aranAI : public ScriptedAI
//We only care about inturrupt effects and only if they are durring a spell currently being casted
if ((Spell->Effect[0] != SPELL_EFFECT_INTERRUPT_CAST &&
Spell->Effect[1] != SPELL_EFFECT_INTERRUPT_CAST &&
Spell->Effect[2] != SPELL_EFFECT_INTERRUPT_CAST) || !m_creature->IsNonMeleeSpellCasted(false))
Spell->Effect[2] != SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCasted(false))
return;
//Inturrupt effect
m_creature->InterruptNonMeleeSpells(false);
me->InterruptNonMeleeSpells(false);
//Normally we would set the cooldown equal to the spell duration
//but we do not have access to the DurationStore
@@ -515,7 +515,7 @@ struct water_elementalAI : public ScriptedAI
if (CastTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WATERBOLT);
DoCast(me->getVictim(), SPELL_WATERBOLT);
CastTimer = urand(2000,5000);
} else CastTimer -= diff;
}
@@ -77,7 +77,7 @@ struct mob_kilrekAI : public ScriptedAI
{
if (!pInstance)
{
ERROR_INST_DATA(m_creature);
ERROR_INST_DATA(me);
return;
}
}
@@ -89,11 +89,11 @@ struct mob_kilrekAI : public ScriptedAI
uint64 TerestianGUID = pInstance->GetData64(DATA_TERESTIAN);
if (TerestianGUID)
{
Unit* Terestian = Unit::GetUnit((*m_creature), TerestianGUID);
Unit* Terestian = Unit::GetUnit((*me), TerestianGUID);
if (Terestian && Terestian->isAlive())
DoCast(Terestian, SPELL_BROKEN_PACT, true);
}
} else ERROR_INST_DATA(m_creature);
} else ERROR_INST_DATA(me);
}
void UpdateAI(const uint32 diff)
@@ -104,8 +104,8 @@ struct mob_kilrekAI : public ScriptedAI
if (AmplifyTimer <= diff)
{
m_creature->InterruptNonMeleeSpells(false);
DoCast(m_creature->getVictim(), SPELL_AMPLIFY_FLAMES);
me->InterruptNonMeleeSpells(false);
DoCast(me->getVictim(), SPELL_AMPLIFY_FLAMES);
AmplifyTimer = urand(10000,20000);
} else AmplifyTimer -= diff;
@@ -133,7 +133,7 @@ struct mob_demon_chainAI : public ScriptedAI
{
if (SacrificeGUID)
{
Unit* Sacrifice = Unit::GetUnit((*m_creature),SacrificeGUID);
Unit* Sacrifice = Unit::GetUnit((*me),SacrificeGUID);
if (Sacrifice)
Sacrifice->RemoveAurasDueToSpell(SPELL_SACRIFICE);
}
@@ -142,7 +142,7 @@ struct mob_demon_chainAI : public ScriptedAI
struct mob_fiendish_portalAI : public PassiveAI
{
mob_fiendish_portalAI(Creature *c) : PassiveAI(c),summons(m_creature){}
mob_fiendish_portalAI(Creature *c) : PassiveAI(c),summons(me){}
SummonList summons;
@@ -191,7 +191,7 @@ struct boss_terestianAI : public ScriptedAI
{
if (PortalGUID[i])
{
if (Creature* pPortal = Unit::GetCreature(*m_creature, PortalGUID[i]))
if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[i]))
{
CAST_AI(mob_fiendish_portalAI, pPortal->AI())->DespawnAllImp();
pPortal->ForcedDespawn();
@@ -213,22 +213,22 @@ struct boss_terestianAI : public ScriptedAI
if (pInstance)
pInstance->SetData(TYPE_TERESTIAN, NOT_STARTED);
m_creature->RemoveAurasDueToSpell(SPELL_BROKEN_PACT);
me->RemoveAurasDueToSpell(SPELL_BROKEN_PACT);
if (Minion* Kilrek = m_creature->GetFirstMinion())
if (Minion* Kilrek = me->GetFirstMinion())
{
if (!Kilrek->isAlive())
{
Kilrek->UnSummon();
DoCast(m_creature, SPELL_SUMMON_IMP, true);
DoCast(me, SPELL_SUMMON_IMP, true);
}
}
else DoCast(m_creature, SPELL_SUMMON_IMP, true);
else DoCast(me, SPELL_SUMMON_IMP, true);
}
void EnterCombat(Unit* who)
{
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
}
void JustSummoned(Creature* pSummoned)
@@ -240,7 +240,7 @@ struct boss_terestianAI : public ScriptedAI
if (pSummoned->GetUInt32Value(UNIT_CREATED_BY_SPELL) == SPELL_FIENDISH_PORTAL_1)
{
DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), m_creature);
DoScriptText(RAND(SAY_SUMMON1,SAY_SUMMON2), me);
SummonedPortals = true;
}
}
@@ -248,7 +248,7 @@ struct boss_terestianAI : public ScriptedAI
void KilledUnit(Unit *victim)
{
DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), m_creature);
DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me);
}
void JustDied(Unit *killer)
@@ -257,14 +257,14 @@ struct boss_terestianAI : public ScriptedAI
{
if (PortalGUID[i])
{
if (Creature* pPortal = Unit::GetCreature((*m_creature), PortalGUID[i]))
if (Creature* pPortal = Unit::GetCreature((*me), PortalGUID[i]))
pPortal->ForcedDespawn();
PortalGUID[i] = 0;
}
}
DoScriptText(SAY_DEATH, m_creature);
DoScriptText(SAY_DEATH, me);
if (pInstance)
pInstance->SetData(TYPE_TERESTIAN, DONE);
@@ -283,11 +283,11 @@ struct boss_terestianAI : public ScriptedAI
DoCast(pTarget, SPELL_SACRIFICE, true);
DoCast(pTarget, SPELL_SUMMON_DEMONCHAINS, true);
if (Creature* Chains = m_creature->FindNearestCreature(CREATURE_DEMONCHAINS, 5000))
if (Creature* Chains = me->FindNearestCreature(CREATURE_DEMONCHAINS, 5000))
{
CAST_AI(mob_demon_chainAI, Chains->AI())->SacrificeGUID = pTarget->GetGUID();
Chains->CastSpell(Chains, SPELL_DEMON_CHAINS, true);
DoScriptText(RAND(SAY_SACRIFICE1,SAY_SACRIFICE2), m_creature);
DoScriptText(RAND(SAY_SACRIFICE1,SAY_SACRIFICE2), me);
SacrificeTimer = 30000;
}
}
@@ -302,15 +302,15 @@ struct boss_terestianAI : public ScriptedAI
if (SummonTimer <= diff)
{
if (!PortalGUID[0])
DoCast(m_creature->getVictim(), SPELL_FIENDISH_PORTAL, false);
DoCast(me->getVictim(), SPELL_FIENDISH_PORTAL, false);
if (!PortalGUID[1])
DoCast(m_creature->getVictim(), SPELL_FIENDISH_PORTAL_1, false);
DoCast(me->getVictim(), SPELL_FIENDISH_PORTAL_1, false);
if (PortalGUID[0] && PortalGUID[1])
{
if (Creature* pPortal = Unit::GetCreature(*m_creature, PortalGUID[urand(0,1)]))
pPortal->CastSpell(m_creature->getVictim(), SPELL_SUMMON_FIENDISIMP, false);
if (Creature* pPortal = Unit::GetCreature(*me, PortalGUID[urand(0,1)]))
pPortal->CastSpell(me->getVictim(), SPELL_SUMMON_FIENDISIMP, false);
SummonTimer = 5000;
}
} else SummonTimer -= diff;
@@ -319,7 +319,7 @@ struct boss_terestianAI : public ScriptedAI
{
if (BerserkTimer <= diff)
{
DoCast(m_creature, SPELL_BERSERK);
DoCast(me, SPELL_BERSERK);
Berserk = true;
} else BerserkTimer -= diff;
}
@@ -340,7 +340,7 @@ struct mob_fiendish_impAI : public ScriptedAI
{
FireboltTimer = 2000;
m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true);
me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true);
}
void EnterCombat(Unit *who) {}
@@ -353,7 +353,7 @@ struct mob_fiendish_impAI : public ScriptedAI
if (FireboltTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FIREBOLT);
DoCast(me->getVictim(), SPELL_FIREBOLT);
FireboltTimer = 2200;
} else FireboltTimer -= diff;
@@ -132,27 +132,27 @@ struct boss_dorotheeAI : public ScriptedAI
void EnterCombat(Unit* who)
{
DoScriptText(SAY_DOROTHEE_AGGRO, m_creature);
DoScriptText(SAY_DOROTHEE_AGGRO, me);
}
void JustReachedHome()
{
m_creature->ForcedDespawn();
me->ForcedDespawn();
}
void SummonTito(); // See below
void JustDied(Unit* killer)
{
DoScriptText(SAY_DOROTHEE_DEATH, m_creature);
DoScriptText(SAY_DOROTHEE_DEATH, me);
if (pInstance)
SummonCroneIfReady(pInstance, m_creature);
SummonCroneIfReady(pInstance, me);
}
void AttackStart(Unit* who)
{
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::AttackStart(who);
@@ -160,7 +160,7 @@ struct boss_dorotheeAI : public ScriptedAI
void MoveInLineOfSight(Unit* who)
{
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::MoveInLineOfSight(who);
@@ -172,7 +172,7 @@ struct boss_dorotheeAI : public ScriptedAI
{
if (AggroTimer <= diff)
{
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
AggroTimer = 0;
} else AggroTimer -= diff;
}
@@ -188,7 +188,7 @@ struct boss_dorotheeAI : public ScriptedAI
if (FearTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SCREAM);
DoCast(me->getVictim(), SPELL_SCREAM);
FearTimer = 30000;
} else FearTimer -= diff;
@@ -222,7 +222,7 @@ struct mob_titoAI : public ScriptedAI
{
if (DorotheeGUID)
{
Creature* Dorothee = (Unit::GetCreature((*m_creature), DorotheeGUID));
Creature* Dorothee = (Unit::GetCreature((*me), DorotheeGUID));
if (Dorothee && Dorothee->isAlive())
{
CAST_AI(boss_dorotheeAI, Dorothee->AI())->TitoDied = true;
@@ -238,7 +238,7 @@ struct mob_titoAI : public ScriptedAI
if (YipTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_YIPPING);
DoCast(me->getVictim(), SPELL_YIPPING);
YipTimer = 10000;
} else YipTimer -= diff;
@@ -248,11 +248,11 @@ struct mob_titoAI : public ScriptedAI
void boss_dorotheeAI::SummonTito()
{
if (Creature* pTito = m_creature->SummonCreature(CREATURE_TITO, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000))
if (Creature* pTito = me->SummonCreature(CREATURE_TITO, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000))
{
DoScriptText(SAY_DOROTHEE_SUMMON, m_creature);
CAST_AI(mob_titoAI, pTito->AI())->DorotheeGUID = m_creature->GetGUID();
pTito->AI()->AttackStart(m_creature->getVictim());
DoScriptText(SAY_DOROTHEE_SUMMON, me);
CAST_AI(mob_titoAI, pTito->AI())->DorotheeGUID = me->GetGUID();
pTito->AI()->AttackStart(me->getVictim());
SummonedTito = true;
TitoDied = false;
}
@@ -280,7 +280,7 @@ struct boss_strawmanAI : public ScriptedAI
void AttackStart(Unit* who)
{
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::AttackStart(who);
@@ -288,7 +288,7 @@ struct boss_strawmanAI : public ScriptedAI
void MoveInLineOfSight(Unit* who)
{
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::MoveInLineOfSight(who);
@@ -296,12 +296,12 @@ struct boss_strawmanAI : public ScriptedAI
void EnterCombat(Unit* who)
{
DoScriptText(SAY_STRAWMAN_AGGRO, m_creature);
DoScriptText(SAY_STRAWMAN_AGGRO, me);
}
void JustReachedHome()
{
m_creature->ForcedDespawn();
me->ForcedDespawn();
}
void SpellHit(Unit* caster, const SpellEntry *Spell)
@@ -313,21 +313,21 @@ struct boss_strawmanAI : public ScriptedAI
return;
*/
DoCast(m_creature, SPELL_BURNING_STRAW, true);
DoCast(me, SPELL_BURNING_STRAW, true);
}
}
void JustDied(Unit* killer)
{
DoScriptText(SAY_STRAWMAN_DEATH, m_creature);
DoScriptText(SAY_STRAWMAN_DEATH, me);
if (pInstance)
SummonCroneIfReady(pInstance, m_creature);
SummonCroneIfReady(pInstance, me);
}
void KilledUnit(Unit* victim)
{
DoScriptText(SAY_STRAWMAN_SLAY, m_creature);
DoScriptText(SAY_STRAWMAN_SLAY, me);
}
void UpdateAI(const uint32 diff)
@@ -336,7 +336,7 @@ struct boss_strawmanAI : public ScriptedAI
{
if (AggroTimer <= diff)
{
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
AggroTimer = 0;
} else AggroTimer -= diff;
}
@@ -346,7 +346,7 @@ struct boss_strawmanAI : public ScriptedAI
if (BrainBashTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_BRAIN_BASH);
DoCast(me->getVictim(), SPELL_BRAIN_BASH);
BrainBashTimer = 15000;
} else BrainBashTimer -= diff;
@@ -387,17 +387,17 @@ struct boss_tinheadAI : public ScriptedAI
void EnterCombat(Unit* who)
{
DoScriptText(SAY_TINHEAD_AGGRO, m_creature);
DoScriptText(SAY_TINHEAD_AGGRO, me);
}
void JustReachedHome()
{
m_creature->ForcedDespawn();
me->ForcedDespawn();
}
void AttackStart(Unit* who)
{
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::AttackStart(who);
@@ -405,7 +405,7 @@ struct boss_tinheadAI : public ScriptedAI
void MoveInLineOfSight(Unit* who)
{
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::MoveInLineOfSight(who);
@@ -413,15 +413,15 @@ struct boss_tinheadAI : public ScriptedAI
void JustDied(Unit* killer)
{
DoScriptText(SAY_TINHEAD_DEATH, m_creature);
DoScriptText(SAY_TINHEAD_DEATH, me);
if (pInstance)
SummonCroneIfReady(pInstance, m_creature);
SummonCroneIfReady(pInstance, me);
}
void KilledUnit(Unit* victim)
{
DoScriptText(SAY_TINHEAD_SLAY, m_creature);
DoScriptText(SAY_TINHEAD_SLAY, me);
}
void UpdateAI(const uint32 diff)
@@ -430,7 +430,7 @@ struct boss_tinheadAI : public ScriptedAI
{
if (AggroTimer <= diff)
{
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
AggroTimer = 0;
} else AggroTimer -= diff;
}
@@ -440,7 +440,7 @@ struct boss_tinheadAI : public ScriptedAI
if (CleaveTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
CleaveTimer = 5000;
} else CleaveTimer -= diff;
@@ -449,8 +449,8 @@ struct boss_tinheadAI : public ScriptedAI
if (RustTimer <= diff)
{
++RustCount;
DoScriptText(EMOTE_RUST, m_creature);
DoCast(m_creature, SPELL_RUST);
DoScriptText(EMOTE_RUST, me);
DoCast(me, SPELL_RUST);
RustTimer = 6000;
} else RustTimer -= diff;
}
@@ -483,7 +483,7 @@ struct boss_roarAI : public ScriptedAI
void MoveInLineOfSight(Unit* who)
{
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::MoveInLineOfSight(who);
@@ -491,7 +491,7 @@ struct boss_roarAI : public ScriptedAI
void AttackStart(Unit* who)
{
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::AttackStart(who);
@@ -499,25 +499,25 @@ struct boss_roarAI : public ScriptedAI
void EnterCombat(Unit* who)
{
DoScriptText(SAY_ROAR_AGGRO, m_creature);
DoScriptText(SAY_ROAR_AGGRO, me);
}
void JustReachedHome()
{
m_creature->ForcedDespawn();
me->ForcedDespawn();
}
void JustDied(Unit* killer)
{
DoScriptText(SAY_ROAR_DEATH, m_creature);
DoScriptText(SAY_ROAR_DEATH, me);
if (pInstance)
SummonCroneIfReady(pInstance, m_creature);
SummonCroneIfReady(pInstance, me);
}
void KilledUnit(Unit* victim)
{
DoScriptText(SAY_ROAR_SLAY, m_creature);
DoScriptText(SAY_ROAR_SLAY, me);
}
void UpdateAI(const uint32 diff)
@@ -526,7 +526,7 @@ struct boss_roarAI : public ScriptedAI
{
if (AggroTimer <= diff)
{
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
AggroTimer = 0;
} else AggroTimer -= diff;
}
@@ -536,19 +536,19 @@ struct boss_roarAI : public ScriptedAI
if (MangleTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_MANGLE);
DoCast(me->getVictim(), SPELL_MANGLE);
MangleTimer = urand(5000,8000);
} else MangleTimer -= diff;
if (ShredTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHRED);
DoCast(me->getVictim(), SPELL_SHRED);
ShredTimer = urand(10000,15000);
} else ShredTimer -= diff;
if (ScreamTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FRIGHTENED_SCREAM);
DoCast(me->getVictim(), SPELL_FRIGHTENED_SCREAM);
ScreamTimer = urand(20000,30000);
} else ScreamTimer -= diff;
@@ -576,19 +576,19 @@ struct boss_croneAI : public ScriptedAI
void JustReachedHome()
{
m_creature->ForcedDespawn();
me->ForcedDespawn();
}
void EnterCombat(Unit* who)
{
DoScriptText(RAND(SAY_CRONE_AGGRO,SAY_CRONE_AGGRO2), m_creature);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
DoScriptText(RAND(SAY_CRONE_AGGRO,SAY_CRONE_AGGRO2), me);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
}
void JustDied(Unit* killer)
{
DoScriptText(SAY_CRONE_DEATH, m_creature);
DoScriptText(SAY_CRONE_DEATH, me);
if (pInstance)
{
@@ -606,8 +606,8 @@ struct boss_croneAI : public ScriptedAI
if (!UpdateVictim())
return;
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
if (CycloneTimer <= diff)
{
@@ -618,7 +618,7 @@ struct boss_croneAI : public ScriptedAI
if (ChainLightningTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CHAIN_LIGHTNING);
DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING);
ChainLightningTimer = 15000;
} else ChainLightningTimer -= diff;
@@ -645,14 +645,14 @@ struct mob_cycloneAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
if (!m_creature->HasAura(SPELL_KNOCKBACK))
DoCast(m_creature, SPELL_KNOCKBACK, true);
if (!me->HasAura(SPELL_KNOCKBACK))
DoCast(me, SPELL_KNOCKBACK, true);
if (MoveTimer <= diff)
{
Position pos;
m_creature->GetRandomNearPosition(pos, 10);
m_creature->GetMotionMaster()->MovePoint(0, pos);
me->GetRandomNearPosition(pos, 10);
me->GetMotionMaster()->MovePoint(0, pos);
MoveTimer = urand(5000,8000);
} else MoveTimer -= diff;
}
@@ -766,17 +766,17 @@ struct boss_bigbadwolfAI : public ScriptedAI
void EnterCombat(Unit* who)
{
DoScriptText(SAY_WOLF_AGGRO, m_creature);
DoScriptText(SAY_WOLF_AGGRO, me);
}
void JustReachedHome()
{
m_creature->ForcedDespawn();
me->ForcedDespawn();
}
void JustDied(Unit* killer)
{
DoPlaySoundToSet(m_creature, SOUND_WOLF_DEATH);
DoPlaySoundToSet(me, SOUND_WOLF_DEATH);
if (pInstance)
{
@@ -802,13 +802,13 @@ struct boss_bigbadwolfAI : public ScriptedAI
{
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
DoScriptText(SAY_WOLF_HOOD, m_creature);
DoScriptText(SAY_WOLF_HOOD, me);
DoCast(pTarget, SPELL_LITTLE_RED_RIDING_HOOD, true);
TempThreat = DoGetThreat(pTarget);
if (TempThreat)
DoModifyThreatPercent(pTarget, -100);
HoodGUID = pTarget->GetGUID();
m_creature->AddThreat(pTarget, 1000000.0f);
me->AddThreat(pTarget, 1000000.0f);
ChaseTimer = 20000;
IsChasing = true;
}
@@ -817,12 +817,12 @@ struct boss_bigbadwolfAI : public ScriptedAI
{
IsChasing = false;
if (Unit *pTarget = Unit::GetUnit((*m_creature), HoodGUID))
if (Unit *pTarget = Unit::GetUnit((*me), HoodGUID))
{
HoodGUID = 0;
if (DoGetThreat(pTarget))
DoModifyThreatPercent(pTarget, -100);
m_creature->AddThreat(pTarget, TempThreat);
me->AddThreat(pTarget, TempThreat);
TempThreat = 0;
}
@@ -835,13 +835,13 @@ struct boss_bigbadwolfAI : public ScriptedAI
if (FearTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_TERRIFYING_HOWL);
DoCast(me->getVictim(), SPELL_TERRIFYING_HOWL);
FearTimer = urand(25000,35000);
} else FearTimer -= diff;
if (SwipeTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WIDE_SWIPE);
DoCast(me->getVictim(), SPELL_WIDE_SWIPE);
SwipeTimer = urand(25000,30000);
} else SwipeTimer -= diff;
@@ -973,7 +973,7 @@ struct boss_julianneAI : public ScriptedAI
if (IsFakingDeath)
{
Resurrect(m_creature);
Resurrect(me);
IsFakingDeath = false;
}
@@ -985,7 +985,7 @@ struct boss_julianneAI : public ScriptedAI
void AttackStart(Unit* who)
{
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::AttackStart(who);
@@ -993,7 +993,7 @@ struct boss_julianneAI : public ScriptedAI
void MoveInLineOfSight(Unit* who)
{
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::MoveInLineOfSight(who);
@@ -1001,14 +1001,14 @@ struct boss_julianneAI : public ScriptedAI
void JustReachedHome()
{
m_creature->ForcedDespawn();
me->ForcedDespawn();
}
void SpellHit(Unit* caster, const SpellEntry *Spell)
{
if (Spell->Id == SPELL_DRINK_POISON)
{
DoScriptText(SAY_JULIANNE_DEATH01, m_creature);
DoScriptText(SAY_JULIANNE_DEATH01, me);
DrinkPoisonTimer = 2500;
}
}
@@ -1017,7 +1017,7 @@ struct boss_julianneAI : public ScriptedAI
void JustDied(Unit* killer)
{
DoScriptText(SAY_JULIANNE_DEATH02, m_creature);
DoScriptText(SAY_JULIANNE_DEATH02, me);
if (pInstance)
{
@@ -1031,7 +1031,7 @@ struct boss_julianneAI : public ScriptedAI
void KilledUnit(Unit* victim)
{
DoScriptText(SAY_JULIANNE_SLAY, m_creature);
DoScriptText(SAY_JULIANNE_SLAY, me);
}
void UpdateAI(const uint32 diff);
@@ -1079,20 +1079,20 @@ struct boss_romuloAI : public ScriptedAI
void JustReachedHome()
{
m_creature->ForcedDespawn();
me->ForcedDespawn();
}
void DamageTaken(Unit* done_by, uint32 &damage);
void EnterCombat(Unit* who)
{
DoScriptText(SAY_ROMULO_AGGRO, m_creature);
DoScriptText(SAY_ROMULO_AGGRO, me);
if (JulianneGUID)
{
Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID));
Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID));
if (Julianne && Julianne->getVictim())
{
m_creature->AddThreat(Julianne->getVictim(), 1.0f);
me->AddThreat(Julianne->getVictim(), 1.0f);
AttackStart(Julianne->getVictim());
}
}
@@ -1100,7 +1100,7 @@ struct boss_romuloAI : public ScriptedAI
void MoveInLineOfSight(Unit* who)
{
if (m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return;
ScriptedAI::MoveInLineOfSight(who);
@@ -1108,7 +1108,7 @@ struct boss_romuloAI : public ScriptedAI
void JustDied(Unit* killer)
{
DoScriptText(SAY_ROMULO_DEATH, m_creature);
DoScriptText(SAY_ROMULO_DEATH, me);
if (pInstance)
{
@@ -1123,7 +1123,7 @@ struct boss_romuloAI : public ScriptedAI
void KilledUnit(Unit* victim)
{
DoScriptText(SAY_ROMULO_SLAY, m_creature);
DoScriptText(SAY_ROMULO_SLAY, me);
}
void UpdateAI(const uint32 diff);
@@ -1131,7 +1131,7 @@ struct boss_romuloAI : public ScriptedAI
void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage)
{
if (damage < m_creature->GetHealth())
if (damage < me->GetHealth())
return;
//anything below only used if incoming damage will kill
@@ -1144,11 +1144,11 @@ void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage)
if (IsFakingDeath)
return;
m_creature->InterruptNonMeleeSpells(true);
DoCast(m_creature, SPELL_DRINK_POISON);
me->InterruptNonMeleeSpells(true);
DoCast(me, SPELL_DRINK_POISON);
IsFakingDeath = true;
//IS THIS USEFULL? Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID));
//IS THIS USEFULL? Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID));
return;
}
@@ -1164,7 +1164,7 @@ void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage)
//if this is true then we have to kill romulo too
if (RomuloDead)
{
if (Creature* Romulo = (Unit::GetCreature((*m_creature), RomuloGUID)))
if (Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID)))
{
Romulo->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Romulo->GetMotionMaster()->Clear();
@@ -1178,9 +1178,9 @@ void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage)
}
//if not already returned, then romulo is alive and we can pretend die
if (Creature* Romulo = (Unit::GetCreature((*m_creature), RomuloGUID)))
if (Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID)))
{
PretendToDie(m_creature);
PretendToDie(me);
IsFakingDeath = true;
CAST_AI(boss_romuloAI, Romulo->AI())->ResurrectTimer = 10000;
CAST_AI(boss_romuloAI, Romulo->AI())->JulianneDead = true;
@@ -1193,19 +1193,19 @@ void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage)
void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage)
{
if (damage < m_creature->GetHealth())
if (damage < me->GetHealth())
return;
//anything below only used if incoming damage will kill
if (Phase == PHASE_ROMULO)
{
DoScriptText(SAY_ROMULO_DEATH, m_creature);
PretendToDie(m_creature);
DoScriptText(SAY_ROMULO_DEATH, me);
PretendToDie(me);
IsFakingDeath = true;
Phase = PHASE_BOTH;
if (Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID)))
if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)))
{
CAST_AI(boss_julianneAI, Julianne->AI())->RomuloDead = true;
CAST_AI(boss_julianneAI, Julianne->AI())->ResurrectSelfTimer = 10000;
@@ -1219,7 +1219,7 @@ void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage)
{
if (JulianneDead)
{
if (Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID)))
if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)))
{
Julianne->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Julianne->GetMotionMaster()->Clear();
@@ -1231,9 +1231,9 @@ void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage)
return;
}
if (Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID)))
if (Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID)))
{
PretendToDie(m_creature);
PretendToDie(me);
IsFakingDeath = true;
CAST_AI(boss_julianneAI, Julianne->AI())->ResurrectTimer = 10000;
CAST_AI(boss_julianneAI, Julianne->AI())->RomuloDead = true;
@@ -1251,7 +1251,7 @@ void boss_julianneAI::UpdateAI(const uint32 diff)
{
if (EntryYellTimer <= diff)
{
DoScriptText(SAY_JULIANNE_ENTER, m_creature);
DoScriptText(SAY_JULIANNE_ENTER, me);
EntryYellTimer = 0;
} else EntryYellTimer -= diff;
}
@@ -1260,9 +1260,9 @@ void boss_julianneAI::UpdateAI(const uint32 diff)
{
if (AggroYellTimer <= diff)
{
DoScriptText(SAY_JULIANNE_AGGRO, m_creature);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->setFaction(16);
DoScriptText(SAY_JULIANNE_AGGRO, me);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->setFaction(16);
AggroYellTimer = 0;
} else AggroYellTimer -= diff;
}
@@ -1272,7 +1272,7 @@ void boss_julianneAI::UpdateAI(const uint32 diff)
//will do this 2secs after spell hit. this is time to display visual as expected
if (DrinkPoisonTimer <= diff)
{
PretendToDie(m_creature);
PretendToDie(me);
Phase = PHASE_ROMULO;
SummonRomuloTimer = 10000;
DrinkPoisonTimer = 0;
@@ -1283,10 +1283,10 @@ void boss_julianneAI::UpdateAI(const uint32 diff)
{
if (SummonRomuloTimer <= diff)
{
if (Creature* pRomulo = m_creature->SummonCreature(CREATURE_ROMULO, ROMULO_X, ROMULO_Y, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILISECONDS))
if (Creature* pRomulo = me->SummonCreature(CREATURE_ROMULO, ROMULO_X, ROMULO_Y, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILISECONDS))
{
RomuloGUID = pRomulo->GetGUID();
CAST_AI(boss_romuloAI, pRomulo->AI())->JulianneGUID = m_creature->GetGUID();
CAST_AI(boss_romuloAI, pRomulo->AI())->JulianneGUID = me->GetGUID();
CAST_AI(boss_romuloAI, pRomulo->AI())->Phase = PHASE_ROMULO;
DoZoneInCombat(pRomulo);
@@ -1300,12 +1300,12 @@ void boss_julianneAI::UpdateAI(const uint32 diff)
{
if (ResurrectSelfTimer <= diff)
{
Resurrect(m_creature);
Resurrect(me);
Phase = PHASE_BOTH;
IsFakingDeath = false;
if (m_creature->getVictim())
AttackStart(m_creature->getVictim());
if (me->getVictim())
AttackStart(me->getVictim());
ResurrectSelfTimer = 0;
ResurrectTimer = 1000;
@@ -1319,10 +1319,10 @@ void boss_julianneAI::UpdateAI(const uint32 diff)
{
if (ResurrectTimer <= diff)
{
Creature* Romulo = (Unit::GetCreature((*m_creature), RomuloGUID));
Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID));
if (Romulo && CAST_AI(boss_romuloAI, Romulo->AI())->IsFakingDeath)
{
DoScriptText(SAY_JULIANNE_RESURRECT, m_creature);
DoScriptText(SAY_JULIANNE_RESURRECT, me);
Resurrect(Romulo);
CAST_AI(boss_romuloAI, Romulo->AI())->IsFakingDeath = false;
RomuloDead = false;
@@ -1340,7 +1340,7 @@ void boss_julianneAI::UpdateAI(const uint32 diff)
if (DevotionTimer <= diff)
{
DoCast(m_creature, SPELL_DEVOTION);
DoCast(me, SPELL_DEVOTION);
DevotionTimer = urand(15000,45000);
} else DevotionTimer -= diff;
@@ -1354,10 +1354,10 @@ void boss_julianneAI::UpdateAI(const uint32 diff)
{
if (urand(0,1) && SummonedRomulo)
{
Creature* Romulo = (Unit::GetCreature((*m_creature), RomuloGUID));
Creature* Romulo = (Unit::GetCreature((*me), RomuloGUID));
if (Romulo && Romulo->isAlive() && !RomuloDead)
DoCast(Romulo, SPELL_ETERNAL_AFFECTION);
} else DoCast(m_creature, SPELL_ETERNAL_AFFECTION);
} else DoCast(me, SPELL_ETERNAL_AFFECTION);
EternalAffectionTimer = urand(45000,60000);
} else EternalAffectionTimer -= diff;
@@ -1374,10 +1374,10 @@ void boss_romuloAI::UpdateAI(const uint32 diff)
{
if (ResurrectTimer <= diff)
{
Creature* Julianne = (Unit::GetCreature((*m_creature), JulianneGUID));
Creature* Julianne = (Unit::GetCreature((*me), JulianneGUID));
if (Julianne && CAST_AI(boss_julianneAI, Julianne->AI())->IsFakingDeath)
{
DoScriptText(SAY_ROMULO_RESURRECT, m_creature);
DoScriptText(SAY_ROMULO_RESURRECT, me);
Resurrect(Julianne);
CAST_AI(boss_julianneAI, Julianne->AI())->IsFakingDeath = false;
JulianneDead = false;
@@ -1389,7 +1389,7 @@ void boss_romuloAI::UpdateAI(const uint32 diff)
if (BackwardLungeTimer <= diff)
{
Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 100, true);
if (pTarget && !m_creature->HasInArc(M_PI, pTarget))
if (pTarget && !me->HasInArc(M_PI, pTarget))
{
DoCast(pTarget, SPELL_BACKWARD_LUNGE);
BackwardLungeTimer = urand(15000,30000);
@@ -1398,7 +1398,7 @@ void boss_romuloAI::UpdateAI(const uint32 diff)
if (DaringTimer <= diff)
{
DoCast(m_creature, SPELL_DARING);
DoCast(me, SPELL_DARING);
DaringTimer = urand(20000,40000);
} else DaringTimer -= diff;
@@ -1411,7 +1411,7 @@ void boss_romuloAI::UpdateAI(const uint32 diff)
if (PoisonThrustTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_POISON_THRUST);
DoCast(me->getVictim(), SPELL_POISON_THRUST);
PoisonThrustTimer = urand(10000,20000);
} else PoisonThrustTimer -= diff;
@@ -159,15 +159,15 @@ struct npc_barnesAI : public npc_escortAI
switch(i)
{
case 0:
DoCast(m_creature, SPELL_TUXEDO, false);
DoCast(me, SPELL_TUXEDO, false);
pInstance->DoUseDoorOrButton(pInstance->GetData64(DATA_GO_STAGEDOORLEFT));
break;
case 4:
TalkCount = 0;
SetEscortPaused(true);
if (Creature* pSpotlight = m_creature->SummonCreature(CREATURE_SPOTLIGHT,
m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0.0f,
if (Creature* pSpotlight = me->SummonCreature(CREATURE_SPOTLIGHT,
me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0.0f,
TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000))
{
pSpotlight->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -215,7 +215,7 @@ struct npc_barnesAI : public npc_escortAI
}
if (text)
DoScriptText(text, m_creature);
DoScriptText(text, me);
}
void PrepareEncounter()
@@ -245,7 +245,7 @@ struct npc_barnesAI : public npc_escortAI
uint32 entry = ((uint32)Spawns[index][0]);
float PosX = Spawns[index][1];
if (Creature* pCreature = m_creature->SummonCreature(entry, PosX, SPAWN_Y, SPAWN_Z, SPAWN_O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILISECONDS))
if (Creature* pCreature = me->SummonCreature(entry, PosX, SPAWN_Y, SPAWN_Z, SPAWN_O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, HOUR*2*IN_MILISECONDS))
{
// In case database has bad flags
pCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0);
@@ -266,7 +266,7 @@ struct npc_barnesAI : public npc_escortAI
{
if (TalkCount > 3)
{
if (Creature* pSpotlight = Unit::GetCreature(*m_creature, m_uiSpotlightGUID))
if (Creature* pSpotlight = Unit::GetCreature(*me, m_uiSpotlightGUID))
pSpotlight->ForcedDespawn();
SetEscortPaused(false);
@@ -284,7 +284,7 @@ struct npc_barnesAI : public npc_escortAI
{
if (WipeTimer <= diff)
{
Map* pMap = m_creature->GetMap();
Map* pMap = me->GetMap();
if (!pMap->IsDungeon())
return;
@@ -468,13 +468,13 @@ struct npc_image_of_medivhAI : public ScriptedAI
if (pInstance && pInstance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0)
{
pInstance->SetData64(DATA_IMAGE_OF_MEDIVH, m_creature->GetGUID());
(*m_creature).GetMotionMaster()->MovePoint(1,MedivPos[0],MedivPos[1],MedivPos[2]);
pInstance->SetData64(DATA_IMAGE_OF_MEDIVH, me->GetGUID());
(*me).GetMotionMaster()->MovePoint(1,MedivPos[0],MedivPos[1],MedivPos[2]);
Step = 0;
}else
{
m_creature->DealDamage(m_creature,m_creature->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
m_creature->RemoveCorpse();
me->DealDamage(me,me->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
me->RemoveCorpse();
}
}
void EnterCombat(Unit* who){}
@@ -486,8 +486,8 @@ struct npc_image_of_medivhAI : public ScriptedAI
if (id == 1)
{
StartEvent();
m_creature->SetOrientation(MedivPos[3]);
m_creature->SetOrientation(MedivPos[3]);
me->SetOrientation(MedivPos[3]);
me->SetOrientation(MedivPos[3]);
}
}
@@ -495,40 +495,40 @@ struct npc_image_of_medivhAI : public ScriptedAI
{
Step = 1;
EventStarted = true;
Creature* Arcanagos = m_creature->SummonCreature(MOB_ARCANAGOS,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000);
Creature* Arcanagos = me->SummonCreature(MOB_ARCANAGOS,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000);
if (!Arcanagos)
return;
ArcanagosGUID = Arcanagos->GetGUID();
Arcanagos->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
(*Arcanagos).GetMotionMaster()->MovePoint(0,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2]);
Arcanagos->SetOrientation(ArcanagosPos[3]);
m_creature->SetOrientation(MedivPos[3]);
me->SetOrientation(MedivPos[3]);
YellTimer = 10000;
}
uint32 NextStep(uint32 Step)
{
Unit* arca = Unit::GetUnit((*m_creature),ArcanagosGUID);
Map* pMap = m_creature->GetMap();
Unit* arca = Unit::GetUnit((*me),ArcanagosGUID);
Map* pMap = me->GetMap();
switch(Step)
{
case 0: return 9999999;
case 1:
m_creature->MonsterYell(SAY_DIALOG_MEDIVH_1,LANG_UNIVERSAL,NULL);
me->MonsterYell(SAY_DIALOG_MEDIVH_1,LANG_UNIVERSAL,NULL);
return 10000;
case 2:
if (arca)
CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_2,LANG_UNIVERSAL,NULL);
return 20000;
case 3:
m_creature->MonsterYell(SAY_DIALOG_MEDIVH_3,LANG_UNIVERSAL,NULL);
me->MonsterYell(SAY_DIALOG_MEDIVH_3,LANG_UNIVERSAL,NULL);
return 10000;
case 4:
if (arca)
CAST_CRE(arca)->MonsterYell(SAY_DIALOG_ARCANAGOS_4, LANG_UNIVERSAL, NULL);
return 20000;
case 5:
m_creature->MonsterYell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL, NULL);
me->MonsterYell(SAY_DIALOG_MEDIVH_5, LANG_UNIVERSAL, NULL);
return 20000;
case 6:
if (arca)
@@ -539,10 +539,10 @@ struct npc_image_of_medivhAI : public ScriptedAI
return 5000;
case 8:
FireMedivhTimer = 500;
DoCast(m_creature, SPELL_MANA_SHIELD);
DoCast(me, SPELL_MANA_SHIELD);
return 10000;
case 9:
m_creature->MonsterTextEmote(EMOTE_DIALOG_MEDIVH_7, 0, false);
me->MonsterTextEmote(EMOTE_DIALOG_MEDIVH_7, 0, false);
return 10000;
case 10:
if (arca)
@@ -559,11 +559,11 @@ struct npc_image_of_medivhAI : public ScriptedAI
arca->SetSpeed(MOVE_FLIGHT, 2.0f);
return 10000;
case 13:
m_creature->MonsterYell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, NULL);
me->MonsterYell(SAY_DIALOG_MEDIVH_9, LANG_UNIVERSAL, NULL);
return 10000;
case 14:
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->ClearInCombat();
me->SetVisibility(VISIBILITY_OFF);
me->ClearInCombat();
if (pMap->IsDungeon())
{
@@ -597,12 +597,12 @@ struct npc_image_of_medivhAI : public ScriptedAI
if (Step >= 7 && Step <= 12)
{
Unit* arca = Unit::GetUnit((*m_creature),ArcanagosGUID);
Unit* arca = Unit::GetUnit((*me),ArcanagosGUID);
if (FireArcanagosTimer <= diff)
{
if (arca)
arca->CastSpell(m_creature, SPELL_FIRE_BALL, false);
arca->CastSpell(me, SPELL_FIRE_BALL, false);
FireArcanagosTimer = 6000;
} else FireArcanagosTimer -= diff;
@@ -137,7 +137,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
void JustDied(Unit *killer)
{
DoScriptText(SAY_DEATH, m_creature);
DoScriptText(SAY_DEATH, me);
if (!pInstance)
return;
@@ -148,7 +148,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
void DamageTaken(Unit* done_by, uint32 &damage)
{
if (damage > m_creature->GetHealth())
if (damage > me->GetHealth())
RemoveGravityLapse(); // Remove Gravity Lapse so that players fall to ground if they kill him when in air.
}
@@ -163,9 +163,9 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
void MoveInLineOfSight(Unit *who)
{
if (!HasTaunted && m_creature->IsWithinDistInMap(who, 40.0))
if (!HasTaunted && me->IsWithinDistInMap(who, 40.0))
{
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
HasTaunted = true;
}
@@ -177,14 +177,14 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
if (!SummonedUnit)
return;
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && pUnit->isAlive())
{
float threat = m_creature->getThreatManager().getThreat(pUnit);
float threat = me->getThreatManager().getThreat(pUnit);
SummonedUnit->AddThreat(pUnit, threat);
}
}
@@ -194,40 +194,40 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
{
float x = KaelLocations[0][0];
float y = KaelLocations[0][1];
m_creature->GetMap()->CreatureRelocation(m_creature, x, y, LOCATION_Z, 0.0f);
//m_creature->SendMonsterMove(x, y, LOCATION_Z, 0, 0, 0); // causes some issues...
std::list<HostileReference*>::const_iterator i = m_creature->getThreatManager().getThreatList().begin();
for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i)
me->GetMap()->CreatureRelocation(me, x, y, LOCATION_Z, 0.0f);
//me->SendMonsterMove(x, y, LOCATION_Z, 0, 0, 0); // causes some issues...
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
pUnit->CastSpell(pUnit, SPELL_TELEPORT_CENTER, true);
}
DoCast(m_creature, SPELL_TELEPORT_CENTER, true);
DoCast(me, SPELL_TELEPORT_CENTER, true);
}
void CastGravityLapseKnockUp()
{
std::list<HostileReference*>::const_iterator i = m_creature->getThreatManager().getThreatList().begin();
for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i)
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
// Knockback into the air
pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, m_creature->GetGUID());
pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID());
}
}
void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air...
{
std::list<HostileReference*>::const_iterator i = m_creature->getThreatManager().getThreatList().begin();
for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i)
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
{
// Also needs an exception in spell system.
pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, m_creature->GetGUID());
pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID());
// Use packet hack
WorldPacket data(12);
data.SetOpcode(SMSG_MOVE_SET_CAN_FLY);
@@ -240,10 +240,10 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
void RemoveGravityLapse()
{
std::list<HostileReference*>::const_iterator i = m_creature->getThreatManager().getThreatList().begin();
for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i)
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
{
pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY);
@@ -273,17 +273,17 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
{
if (PyroblastTimer <= diff)
{
m_creature->InterruptSpell(CURRENT_CHANNELED_SPELL);
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
DoCast(m_creature, SPELL_SHOCK_BARRIER, true);
DoCast(m_creature->getVictim(), SPELL_PYROBLAST);
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
me->InterruptSpell(CURRENT_GENERIC_SPELL);
DoCast(me, SPELL_SHOCK_BARRIER, true);
DoCast(me->getVictim(), SPELL_PYROBLAST);
PyroblastTimer = 60000;
} else PyroblastTimer -= diff;
}
if (FireballTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FIREBALL_NORMAL);
DoCast(me->getVictim(), SPELL_FIREBALL_NORMAL);
FireballTimer = urand(2000,6000);
} else FireballTimer -= diff;
@@ -296,7 +296,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
float x = KaelLocations[random][0];
float y = KaelLocations[random][1];
Creature* Phoenix = m_creature->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000);
Creature* Phoenix = me->SummonCreature(CREATURE_PHOENIX, x, y, LOCATION_Z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000);
if (Phoenix)
{
Phoenix->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE);
@@ -304,7 +304,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
Phoenix->AI()->AttackStart(pTarget);
}
DoScriptText(SAY_PHOENIX, m_creature);
DoScriptText(SAY_PHOENIX, me);
PhoenixTimer = 60000;
} else PhoenixTimer -= diff;
@@ -313,21 +313,21 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
{
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
m_creature->InterruptSpell(CURRENT_CHANNELED_SPELL);
m_creature->InterruptSpell(CURRENT_GENERIC_SPELL);
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
me->InterruptSpell(CURRENT_GENERIC_SPELL);
DoCast(pTarget, SPELL_FLAMESTRIKE3, true);
DoScriptText(SAY_FLAMESTRIKE, m_creature);
DoScriptText(SAY_FLAMESTRIKE, me);
}
FlameStrikeTimer = urand(15000,25000);
} else FlameStrikeTimer -= diff;
// Below 50%
if (m_creature->GetMaxHealth() * 0.5 > m_creature->GetHealth())
if (me->GetMaxHealth() * 0.5 > me->GetHealth())
{
m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);
m_creature->StopMoving();
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_INTERRUPT_CAST, true);
me->StopMoving();
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
GravityLapseTimer = 0;
GravityLapsePhase = 0;
Phase = 1;
@@ -346,7 +346,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
case 0:
if (FirstGravityLapse) // Different yells at 50%, and at every following Gravity Lapse
{
DoScriptText(SAY_GRAVITY_LAPSE, m_creature);
DoScriptText(SAY_GRAVITY_LAPSE, me);
FirstGravityLapse = false;
if (pInstance)
@@ -356,10 +356,10 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
}
}else
{
DoScriptText(SAY_RECAST_GRAVITY, m_creature);
DoScriptText(SAY_RECAST_GRAVITY, me);
}
DoCast(m_creature, SPELL_GRAVITY_LAPSE_INITIAL);
DoCast(me, SPELL_GRAVITY_LAPSE_INITIAL);
GravityLapseTimer = 2000 + diff;// Don't interrupt the visual spell
GravityLapsePhase = 1;
break;
@@ -396,13 +396,13 @@ struct boss_felblood_kaelthasAI : public ScriptedAI
}
DoCast(m_creature, SPELL_GRAVITY_LAPSE_CHANNEL);
DoCast(me, SPELL_GRAVITY_LAPSE_CHANNEL);
break;
case 4:
m_creature->InterruptNonMeleeSpells(false);
DoScriptText(SAY_TIRED, m_creature);
DoCast(m_creature, SPELL_POWER_FEEDBACK);
me->InterruptNonMeleeSpells(false);
DoScriptText(SAY_TIRED, me);
DoCast(me, SPELL_POWER_FEEDBACK);
RemoveGravityLapse();
GravityLapseTimer = 10000;
GravityLapsePhase = 0;
@@ -427,10 +427,10 @@ struct mob_felkael_flamestrikeAI : public ScriptedAI
{
FlameStrikeTimer = 5000;
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->setFaction(14);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->setFaction(14);
DoCast(m_creature, SPELL_FLAMESTRIKE2, true);
DoCast(me, SPELL_FLAMESTRIKE2, true);
}
void EnterCombat(Unit *who) {}
@@ -439,8 +439,8 @@ struct mob_felkael_flamestrikeAI : public ScriptedAI
{
if (FlameStrikeTimer <= diff)
{
DoCast(m_creature, SPELL_FLAMESTRIKE1_NORMAL, true);
m_creature->Kill(m_creature);
DoCast(me, SPELL_FLAMESTRIKE1_NORMAL, true);
me->Kill(me);
} else FlameStrikeTimer -= diff;
}
};
@@ -460,9 +460,9 @@ struct mob_felkael_phoenixAI : public ScriptedAI
void Reset()
{
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE);
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
DoCast(m_creature, SPELL_PHOENIX_BURN, true);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE + UNIT_FLAG_NON_ATTACKABLE);
me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
DoCast(me, SPELL_PHOENIX_BURN, true);
BurnTimer = 2000;
Death_Timer = 3000;
Rebirth = false;
@@ -473,7 +473,7 @@ struct mob_felkael_phoenixAI : public ScriptedAI
void DamageTaken(Unit* pKiller, uint32 &damage)
{
if (damage < m_creature->GetHealth())
if (damage < me->GetHealth())
return;
//Prevent glitch if in fake death
@@ -490,19 +490,19 @@ struct mob_felkael_phoenixAI : public ScriptedAI
damage = 0;
FakeDeath = true;
m_creature->InterruptNonMeleeSpells(false);
m_creature->SetHealth(0);
m_creature->StopMoving();
m_creature->ClearComboPointHolders();
m_creature->RemoveAllAurasOnDeath();
m_creature->ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, false);
m_creature->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->ClearAllReactives();
m_creature->SetUInt64Value(UNIT_FIELD_TARGET,0);
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveIdle();
m_creature->SetStandState(UNIT_STAND_STATE_DEAD);
me->InterruptNonMeleeSpells(false);
me->SetHealth(0);
me->StopMoving();
me->ClearComboPointHolders();
me->RemoveAllAurasOnDeath();
me->ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, false);
me->ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->ClearAllReactives();
me->SetUInt64Value(UNIT_FIELD_TARGET,0);
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
me->SetStandState(UNIT_STAND_STATE_DEAD);
}
@@ -510,7 +510,7 @@ struct mob_felkael_phoenixAI : public ScriptedAI
void JustDied(Unit* slayer)
{
m_creature->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000);
me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000);
}
void UpdateAI(const uint32 diff)
@@ -521,7 +521,7 @@ struct mob_felkael_phoenixAI : public ScriptedAI
{
if (!Rebirth)
{
DoCast(m_creature, SPELL_REBIRTH_DMG);
DoCast(me, SPELL_REBIRTH_DMG);
Rebirth = true;
}
@@ -530,8 +530,8 @@ struct mob_felkael_phoenixAI : public ScriptedAI
if (Death_Timer <= diff)
{
m_creature->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000);
m_creature->DisappearAndDie();
me->SummonCreature(CREATURE_PHOENIX_EGG, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 45000);
me->DisappearAndDie();
Rebirth = false;
} else Death_Timer -= diff;
}
@@ -545,7 +545,7 @@ struct mob_felkael_phoenixAI : public ScriptedAI
{
//spell Burn should possible do this, but it doesn't, so do this for now.
uint16 dmg = urand(1650,2050);
m_creature->DealDamage(m_creature, dmg, 0, DOT, SPELL_SCHOOL_MASK_FIRE, NULL, false);
me->DealDamage(me, dmg, 0, DOT, SPELL_SCHOOL_MASK_FIRE, NULL, false);
BurnTimer += 2000;
} BurnTimer -= diff;
@@ -571,8 +571,8 @@ struct mob_felkael_phoenix_eggAI : public ScriptedAI
{
if (HatchTimer <= diff)
{
m_creature->SummonCreature(CREATURE_PHOENIX, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000);
m_creature->Kill(m_creature);
me->SummonCreature(CREATURE_PHOENIX, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000);
me->Kill(me);
} else HatchTimer -= diff;
}
@@ -590,10 +590,10 @@ struct mob_arcane_sphereAI : public ScriptedAI
DespawnTimer = 30000;
ChangeTargetTimer = urand(6000,12000);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
m_creature->setFaction(14);
DoCast(m_creature, SPELL_ARCANE_SPHERE_PASSIVE, true);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
me->setFaction(14);
DoCast(me, SPELL_ARCANE_SPHERE_PASSIVE, true);
}
void EnterCombat(Unit* who) {}
@@ -601,7 +601,7 @@ struct mob_arcane_sphereAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
if (DespawnTimer <= diff)
m_creature->Kill(m_creature);
me->Kill(me);
else
DespawnTimer -= diff;
@@ -613,8 +613,8 @@ struct mob_arcane_sphereAI : public ScriptedAI
{
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
{
m_creature->AddThreat(pTarget, 1.0f);
m_creature->TauntApply(pTarget);
me->AddThreat(pTarget, 1.0f);
me->TauntApply(pTarget);
AttackStart(pTarget);
}
@@ -131,11 +131,11 @@ struct boss_priestess_delrissaAI : public ScriptedAI
void EnterCombat(Unit* who)
{
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
{
if (Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUID[i]))
if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[i]))
{
if (!pAdd->getVictim())
{
@@ -152,7 +152,7 @@ struct boss_priestess_delrissaAI : public ScriptedAI
void InitializeLackeys()
{
//can be called if Creature are dead, so avoid
if (!m_creature->isAlive())
if (!me->isAlive())
return;
uint8 j = 0;
@@ -174,7 +174,7 @@ struct boss_priestess_delrissaAI : public ScriptedAI
//summon all the remaining in vector
for (std::vector<uint32>::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr)
{
if (Creature* pAdd = m_creature->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0))
if (Creature* pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0))
m_auiLackeyGUID[j] = pAdd->GetGUID();
++j;
@@ -184,12 +184,12 @@ struct boss_priestess_delrissaAI : public ScriptedAI
{
for (std::vector<uint32>::const_iterator itr = LackeyEntryList.begin(); itr != LackeyEntryList.end(); ++itr)
{
Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUID[j]);
Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[j]);
//object already removed, not exist
if (!pAdd)
{
if (Creature* pAdd = m_creature->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0))
if (Creature* pAdd = me->SummonCreature((*itr), LackeyLocations[j][0], LackeyLocations[j][1], fZLocation, fOrientation, TEMPSUMMON_CORPSE_DESPAWN, 0))
m_auiLackeyGUID[j] = pAdd->GetGUID();
}
++j;
@@ -202,7 +202,7 @@ struct boss_priestess_delrissaAI : public ScriptedAI
if (victim->GetTypeId() != TYPEID_PLAYER)
return;
DoScriptText(PlayerDeath[PlayersKilled].id, m_creature);
DoScriptText(PlayerDeath[PlayersKilled].id, me);
if (PlayersKilled < 4)
++PlayersKilled;
@@ -210,7 +210,7 @@ struct boss_priestess_delrissaAI : public ScriptedAI
void JustDied(Unit* killer)
{
DoScriptText(SAY_DEATH, m_creature);
DoScriptText(SAY_DEATH, me);
if (!pInstance)
return;
@@ -219,8 +219,8 @@ struct boss_priestess_delrissaAI : public ScriptedAI
pInstance->SetData(DATA_DELRISSA_EVENT, DONE);
else
{
if (m_creature->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE))
m_creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
if (me->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE))
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
}
@@ -232,8 +232,8 @@ struct boss_priestess_delrissaAI : public ScriptedAI
if (ResetTimer <= diff)
{
float x, y, z, o;
m_creature->GetHomePosition(x, y, z, o);
if (m_creature->GetPositionZ() >= z+10)
me->GetHomePosition(x, y, z, o);
if (me->GetPositionZ() >= z+10)
{
EnterEvadeMode();
return;
@@ -243,11 +243,11 @@ struct boss_priestess_delrissaAI : public ScriptedAI
if (HealTimer <= diff)
{
uint32 health = m_creature->GetHealth();
Unit *pTarget = m_creature;
uint32 health = me->GetHealth();
Unit *pTarget = me;
for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
{
if (Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUID[i]))
if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[i]))
{
if (pAdd->isAlive() && pAdd->GetHealth() < health)
pTarget = pAdd;
@@ -260,10 +260,10 @@ struct boss_priestess_delrissaAI : public ScriptedAI
if (RenewTimer <= diff)
{
Unit *pTarget = m_creature;
Unit *pTarget = me;
if (urand(0,1))
if (Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY]))
if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY]))
if (pAdd->isAlive())
pTarget = pAdd;
@@ -273,10 +273,10 @@ struct boss_priestess_delrissaAI : public ScriptedAI
if (ShieldTimer <= diff)
{
Unit *pTarget = m_creature;
Unit *pTarget = me;
if (urand(0,1))
if (Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY]))
if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY]))
if (pAdd->isAlive() && !pAdd->HasAura(SPELL_SHIELD))
pTarget = pAdd;
@@ -296,9 +296,9 @@ struct boss_priestess_delrissaAI : public ScriptedAI
friendly = true;
if (urand(0,1))
pTarget = m_creature;
pTarget = me;
else
if (Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY]))
if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUID[rand()%MAX_ACTIVE_LACKEY]))
if (pAdd->isAlive())
pTarget = pAdd;
}
@@ -359,7 +359,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
ResetThreatTimer = urand(5000,20000);
// in case she is not alive and Reset was for some reason called, respawn her (most likely party wipe after killing her)
if (Creature* pDelrissa = Unit::GetCreature(*m_creature, pInstance ? pInstance->GetData64(DATA_DELRISSA) : 0))
if (Creature* pDelrissa = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_DELRISSA) : 0))
{
if (!pDelrissa->isAlive())
pDelrissa->Respawn();
@@ -375,9 +375,9 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
{
for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
{
if (Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUIDs[i]))
if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUIDs[i]))
{
if (!pAdd->getVictim() && pAdd != m_creature)
if (!pAdd->getVictim() && pAdd != me)
{
pWho->SetInCombatWith(pAdd);
pAdd->AddThreat(pWho, 0.0f);
@@ -385,7 +385,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
}
}
if (Creature* pDelrissa = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA)))
if (Creature* pDelrissa = Unit::GetCreature(*me, pInstance->GetData64(DATA_DELRISSA)))
{
if (pDelrissa->isAlive() && !pDelrissa->getVictim())
{
@@ -401,7 +401,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
if (!pInstance)
return;
Creature* pDelrissa = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA));
Creature* pDelrissa = Unit::GetCreature(*me, pInstance->GetData64(DATA_DELRISSA));
uint32 uiLackeyDeathCount = pInstance->GetData(DATA_DELRISSA_DEATH_COUNT);
if (!pDelrissa)
@@ -433,7 +433,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
if (!pInstance)
return;
if (Creature* Delrissa = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA)))
if (Creature* Delrissa = Unit::GetCreature(*me, pInstance->GetData64(DATA_DELRISSA)))
Delrissa->AI()->KilledUnit(victim);
}
@@ -442,7 +442,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
if (!pInstance)
return;
if (Creature* Delrissa = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_DELRISSA))))
if (Creature* Delrissa = (Unit::GetCreature(*me, pInstance->GetData64(DATA_DELRISSA))))
{
for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
m_auiLackeyGUIDs[i] = CAST_AI(boss_priestess_delrissaAI, Delrissa->AI())->m_auiLackeyGUID[i];
@@ -451,9 +451,9 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
if (!UsedPotion && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 25)
if (!UsedPotion && (me->GetHealth()*100 / me->GetMaxHealth()) < 25)
{
DoCast(m_creature, SPELL_HEALING_POTION);
DoCast(me, SPELL_HEALING_POTION);
UsedPotion = true;
}
@@ -495,7 +495,7 @@ struct boss_kagani_nightstrikeAI : public boss_priestess_lackey_commonAI
Eviscerate_Timer = 6000;
Wait_Timer = 5000;
InVanish = false;
m_creature->SetVisibility(VISIBILITY_ON);
me->SetVisibility(VISIBILITY_ON);
boss_priestess_lackey_commonAI::Reset();
}
@@ -509,14 +509,14 @@ struct boss_kagani_nightstrikeAI : public boss_priestess_lackey_commonAI
if (Vanish_Timer <= diff)
{
DoCast(m_creature, SPELL_VANISH);
DoCast(me, SPELL_VANISH);
Unit* pUnit = SelectUnit(SELECT_TARGET_RANDOM, 0);
DoResetThreat();
if (pUnit)
m_creature->AddThreat(pUnit, 1000.0f);
me->AddThreat(pUnit, 1000.0f);
InVanish = true;
Vanish_Timer = 30000;
@@ -527,28 +527,28 @@ struct boss_kagani_nightstrikeAI : public boss_priestess_lackey_commonAI
{
if (Wait_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_BACKSTAB, true);
DoCast(m_creature->getVictim(), SPELL_KIDNEY_SHOT, true);
m_creature->SetVisibility(VISIBILITY_ON); // ...? Hacklike
DoCast(me->getVictim(), SPELL_BACKSTAB, true);
DoCast(me->getVictim(), SPELL_KIDNEY_SHOT, true);
me->SetVisibility(VISIBILITY_ON); // ...? Hacklike
InVanish = false;
} else Wait_Timer -= diff;
}
if (Gouge_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_GOUGE);
DoCast(me->getVictim(), SPELL_GOUGE);
Gouge_Timer = 5500;
} else Gouge_Timer -= diff;
if (Kick_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_KICK);
DoCast(me->getVictim(), SPELL_KICK);
Kick_Timer = 7000;
} else Kick_Timer -= diff;
if (Eviscerate_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_EVISCERATE);
DoCast(me->getVictim(), SPELL_EVISCERATE);
Eviscerate_Timer = 4000;
} else Eviscerate_Timer -= diff;
@@ -597,7 +597,7 @@ struct boss_ellris_duskhallowAI : public boss_priestess_lackey_commonAI
void Aggro(Unit* pWho)
{
DoCast(m_creature, SPELL_SUMMON_IMP);
DoCast(me, SPELL_SUMMON_IMP);
}
void UpdateAI(const uint32 diff)
@@ -609,13 +609,13 @@ struct boss_ellris_duskhallowAI : public boss_priestess_lackey_commonAI
if (Immolate_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_IMMOLATE);
DoCast(me->getVictim(), SPELL_IMMOLATE);
Immolate_Timer = 6000;
} else Immolate_Timer -= diff;
if (Shadow_Bolt_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHADOW_BOLT);
DoCast(me->getVictim(), SPELL_SHADOW_BOLT);
Shadow_Bolt_Timer = 5000;
} else Shadow_Bolt_Timer -= diff;
@@ -683,13 +683,13 @@ struct boss_eramas_brightblazeAI : public boss_priestess_lackey_commonAI
if (Knockdown_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_KNOCKDOWN);
DoCast(me->getVictim(), SPELL_KNOCKDOWN);
Knockdown_Timer = 6000;
} else Knockdown_Timer -= diff;
if (Snap_Kick_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SNAP_KICK);
DoCast(me->getVictim(), SPELL_SNAP_KICK);
Snap_Kick_Timer = 4500;
} else Snap_Kick_Timer -= diff;
@@ -761,9 +761,9 @@ struct boss_yazzaiAI : public boss_priestess_lackey_commonAI
}
} else Polymorph_Timer -= diff;
if (((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 35) && !HasIceBlocked)
if (((me->GetHealth()*100 / me->GetMaxHealth()) < 35) && !HasIceBlocked)
{
DoCast(m_creature, SPELL_ICE_BLOCK);
DoCast(me, SPELL_ICE_BLOCK);
HasIceBlocked = true;
}
@@ -777,32 +777,32 @@ struct boss_yazzaiAI : public boss_priestess_lackey_commonAI
if (Ice_Lance_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_ICE_LANCE);
DoCast(me->getVictim(), SPELL_ICE_LANCE);
Ice_Lance_Timer = 12000;
} else Ice_Lance_Timer -= diff;
if (Cone_of_Cold_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CONE_OF_COLD);
DoCast(me->getVictim(), SPELL_CONE_OF_COLD);
Cone_of_Cold_Timer = 10000;
} else Cone_of_Cold_Timer -= diff;
if (Frostbolt_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FROSTBOLT);
DoCast(me->getVictim(), SPELL_FROSTBOLT);
Frostbolt_Timer = 8000;
} else Frostbolt_Timer -= diff;
if (Blink_Timer <= diff)
{
bool InMeleeRange = false;
std::list<HostileReference*>& t_list = m_creature->getThreatManager().getThreatList();
std::list<HostileReference*>& t_list = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
{
//if in melee range
if (pTarget->IsWithinDistInMap(m_creature, 5))
if (pTarget->IsWithinDistInMap(me, 5))
{
InMeleeRange = true;
break;
@@ -812,7 +812,7 @@ struct boss_yazzaiAI : public boss_priestess_lackey_commonAI
//if anybody is in melee range than escape by blink
if (InMeleeRange)
DoCast(m_creature, SPELL_BLINK);
DoCast(me, SPELL_BLINK);
Blink_Timer = 8000;
} else Blink_Timer -= diff;
@@ -863,7 +863,7 @@ struct boss_warlord_salarisAI : public boss_priestess_lackey_commonAI
void EnterCombat(Unit* who)
{
DoCast(m_creature, SPELL_BATTLE_SHOUT);
DoCast(me, SPELL_BATTLE_SHOUT);
}
void UpdateAI(const uint32 diff)
@@ -876,13 +876,13 @@ struct boss_warlord_salarisAI : public boss_priestess_lackey_commonAI
if (Intercept_Stun_Timer <= diff)
{
bool InMeleeRange = false;
std::list<HostileReference*>& t_list = m_creature->getThreatManager().getThreatList();
std::list<HostileReference*>& t_list = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()))
if (Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
{
//if in melee range
if (pTarget->IsWithinDistInMap(m_creature, ATTACK_DISTANCE))
if (pTarget->IsWithinDistInMap(me, ATTACK_DISTANCE))
{
InMeleeRange = true;
break;
@@ -902,31 +902,31 @@ struct boss_warlord_salarisAI : public boss_priestess_lackey_commonAI
if (Disarm_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_DISARM);
DoCast(me->getVictim(), SPELL_DISARM);
Disarm_Timer = 6000;
} else Disarm_Timer -= diff;
if (Hamstring_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_HAMSTRING);
DoCast(me->getVictim(), SPELL_HAMSTRING);
Hamstring_Timer = 4500;
} else Hamstring_Timer -= diff;
if (Mortal_Strike_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_MORTAL_STRIKE);
DoCast(me->getVictim(), SPELL_MORTAL_STRIKE);
Mortal_Strike_Timer = 4500;
} else Mortal_Strike_Timer -= diff;
if (Piercing_Howl_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_PIERCING_HOWL);
DoCast(me->getVictim(), SPELL_PIERCING_HOWL);
Piercing_Howl_Timer = 10000;
} else Piercing_Howl_Timer -= diff;
if (Frightening_Shout_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FRIGHTENING_SHOUT);
DoCast(me->getVictim(), SPELL_FRIGHTENING_SHOUT);
Frightening_Shout_Timer = 18000;
} else Frightening_Shout_Timer -= diff;
@@ -974,9 +974,9 @@ struct boss_garaxxasAI : public boss_priestess_lackey_commonAI
Wing_Clip_Timer = 4000;
Freezing_Trap_Timer = 15000;
Unit* pPet = Unit::GetUnit(*m_creature,m_uiPetGUID);
Unit* pPet = Unit::GetUnit(*me,m_uiPetGUID);
if (!pPet)
m_creature->SummonCreature(NPC_SLIVER, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
me->SummonCreature(NPC_SLIVER, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
boss_priestess_lackey_commonAI::Reset();
}
@@ -993,18 +993,18 @@ struct boss_garaxxasAI : public boss_priestess_lackey_commonAI
boss_priestess_lackey_commonAI::UpdateAI(diff);
if (m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE))
if (me->IsWithinDistInMap(me->getVictim(), ATTACK_DISTANCE))
{
if (Wing_Clip_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WING_CLIP);
DoCast(me->getVictim(), SPELL_WING_CLIP);
Wing_Clip_Timer = 4000;
} else Wing_Clip_Timer -= diff;
if (Freezing_Trap_Timer <= diff)
{
//attempt find go summoned from spell (casted by m_creature)
GameObject* pGo = m_creature->GetGameObject(SPELL_FREEZING_TRAP);
//attempt find go summoned from spell (casted by me)
GameObject* pGo = me->GetGameObject(SPELL_FREEZING_TRAP);
//if we have a pGo, we need to wait (only one trap at a time)
if (pGo)
@@ -1012,7 +1012,7 @@ struct boss_garaxxasAI : public boss_priestess_lackey_commonAI
else
{
//if pGo does not exist, then we can cast
DoCast(m_creature->getVictim(), SPELL_FREEZING_TRAP);
DoCast(me->getVictim(), SPELL_FREEZING_TRAP);
Freezing_Trap_Timer = 15000;
}
} else Freezing_Trap_Timer -= diff;
@@ -1023,25 +1023,25 @@ struct boss_garaxxasAI : public boss_priestess_lackey_commonAI
{
if (Concussive_Shot_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CONCUSSIVE_SHOT);
DoCast(me->getVictim(), SPELL_CONCUSSIVE_SHOT);
Concussive_Shot_Timer = 8000;
} else Concussive_Shot_Timer -= diff;
if (Multi_Shot_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_MULTI_SHOT);
DoCast(me->getVictim(), SPELL_MULTI_SHOT);
Multi_Shot_Timer = 10000;
} else Multi_Shot_Timer -= diff;
if (Aimed_Shot_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_AIMED_SHOT);
DoCast(me->getVictim(), SPELL_AIMED_SHOT);
Aimed_Shot_Timer = 6000;
} else Aimed_Shot_Timer -= diff;
if (Shoot_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHOOT);
DoCast(me->getVictim(), SPELL_SHOOT);
Shoot_Timer = 2500;
} else Shoot_Timer -= diff;
}
@@ -1097,14 +1097,14 @@ struct boss_apokoAI : public boss_priestess_lackey_commonAI
if (Totem_Timer <= diff)
{
DoCast(m_creature, RAND(SPELL_WINDFURY_TOTEM,SPELL_FIRE_NOVA_TOTEM,SPELL_EARTHBIND_TOTEM));
DoCast(me, RAND(SPELL_WINDFURY_TOTEM,SPELL_FIRE_NOVA_TOTEM,SPELL_EARTHBIND_TOTEM));
++Totem_Amount;
Totem_Timer = Totem_Amount*2000;
} else Totem_Timer -= diff;
if (War_Stomp_Timer <= diff)
{
DoCast(m_creature, SPELL_WAR_STOMP);
DoCast(me, SPELL_WAR_STOMP);
War_Stomp_Timer = 10000;
} else War_Stomp_Timer -= diff;
@@ -1118,7 +1118,7 @@ struct boss_apokoAI : public boss_priestess_lackey_commonAI
if (Frost_Shock_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FROST_SHOCK);
DoCast(me->getVictim(), SPELL_FROST_SHOCK);
Frost_Shock_Timer = 7000;
} else Frost_Shock_Timer -= diff;
@@ -1128,10 +1128,10 @@ struct boss_apokoAI : public boss_priestess_lackey_commonAI
// uint64 guid = (*itr)->guid;
// if (guid)
// {
// Unit* pAdd = Unit::GetUnit(*m_creature, (*itr)->guid);
// Unit* pAdd = Unit::GetUnit(*me, (*itr)->guid);
// if (pAdd && pAdd->isAlive())
// {
DoCast(m_creature, SPELL_LESSER_HEALING_WAVE);
DoCast(me, SPELL_LESSER_HEALING_WAVE);
Healing_Wave_Timer = 5000;
// }
// }
@@ -1187,19 +1187,19 @@ struct boss_zelfanAI : public boss_priestess_lackey_commonAI
if (Goblin_Dragon_Gun_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_GOBLIN_DRAGON_GUN);
DoCast(me->getVictim(), SPELL_GOBLIN_DRAGON_GUN);
Goblin_Dragon_Gun_Timer = 10000;
} else Goblin_Dragon_Gun_Timer -= diff;
if (Rocket_Launch_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_ROCKET_LAUNCH);
DoCast(me->getVictim(), SPELL_ROCKET_LAUNCH);
Rocket_Launch_Timer = 9000;
} else Rocket_Launch_Timer -= diff;
if (Fel_Iron_Bomb_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FEL_IRON_BOMB);
DoCast(me->getVictim(), SPELL_FEL_IRON_BOMB);
Fel_Iron_Bomb_Timer = 15000;
} else Fel_Iron_Bomb_Timer -= diff;
@@ -1207,7 +1207,7 @@ struct boss_zelfanAI : public boss_priestess_lackey_commonAI
{
for (uint8 i = 0; i < MAX_ACTIVE_LACKEY; ++i)
{
if (Unit* pAdd = Unit::GetUnit(*m_creature, m_auiLackeyGUIDs[i]))
if (Unit* pAdd = Unit::GetUnit(*me, m_auiLackeyGUIDs[i]))
{
if (pAdd->IsPolymorphed())
{
@@ -1221,7 +1221,7 @@ struct boss_zelfanAI : public boss_priestess_lackey_commonAI
if (High_Explosive_Sheep_Timer <= diff)
{
DoCast(m_creature, SPELL_HIGH_EXPLOSIVE_SHEEP);
DoCast(me, SPELL_HIGH_EXPLOSIVE_SHEEP);
High_Explosive_Sheep_Timer = 65000;
} else High_Explosive_Sheep_Timer -= diff;
@@ -1253,7 +1253,7 @@ CreatureAI* GetAI_zelfan(Creature* pCreature)
// {
// if (Explosion_Timer <= diff)
// {
// DoCast(m_creature->getVictim(), SPELL_SHEEP_EXPLOSION);
// DoCast(me->getVictim(), SPELL_SHEEP_EXPLOSION);
// }else
// Explosion_Timer -= diff;
// }
@@ -91,8 +91,8 @@ struct boss_selin_fireheartAI : public ScriptedAI
//for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i)
for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{
//Unit* pUnit = Unit::GetUnit(*m_creature, FelCrystals[i]);
Unit* pUnit = Unit::GetUnit(*m_creature, *itr);
//Unit* pUnit = Unit::GetUnit(*me, FelCrystals[i]);
Unit* pUnit = Unit::GetUnit(*me, *itr);
if (pUnit)
{
if (!pUnit->isAlive())
@@ -135,12 +135,12 @@ struct boss_selin_fireheartAI : public ScriptedAI
for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{
pCrystal = NULL;
//pCrystal = Unit::GetUnit(*m_creature, FelCrystals[i]);
pCrystal = Unit::GetUnit(*m_creature, *itr);
//pCrystal = Unit::GetUnit(*me, FelCrystals[i]);
pCrystal = Unit::GetUnit(*me, *itr);
if (pCrystal && pCrystal->isAlive())
{
// select nearest
if (!CrystalChosen || m_creature->GetDistanceOrder(pCrystal, CrystalChosen, false))
if (!CrystalChosen || me->GetDistanceOrder(pCrystal, CrystalChosen, false))
{
CrystalGUID = pCrystal->GetGUID();
CrystalChosen = pCrystal; // Store a copy of pCrystal so we don't need to recreate a pointer to closest crystal for the movement and yell.
@@ -149,16 +149,16 @@ struct boss_selin_fireheartAI : public ScriptedAI
}
if (CrystalChosen)
{
DoScriptText(SAY_ENERGY, m_creature);
DoScriptText(EMOTE_CRYSTAL, m_creature);
DoScriptText(SAY_ENERGY, me);
DoScriptText(EMOTE_CRYSTAL, me);
CrystalChosen->CastSpell(CrystalChosen, SPELL_FEL_CRYSTAL_COSMETIC, true);
float x, y, z; // coords that we move to, close to the crystal.
CrystalChosen->GetClosePoint(x, y, z, m_creature->GetObjectSize(), CONTACT_DISTANCE);
CrystalChosen->GetClosePoint(x, y, z, me->GetObjectSize(), CONTACT_DISTANCE);
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
m_creature->GetMotionMaster()->MovePoint(1, x, y, z);
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
me->GetMotionMaster()->MovePoint(1, x, y, z);
DrainingCrystal = true;
}
}
@@ -171,8 +171,8 @@ struct boss_selin_fireheartAI : public ScriptedAI
//for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i)
for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{
//Creature* pCrystal = (Unit::GetCreature(*m_creature, FelCrystals[i]));
Creature* pCrystal = Unit::GetCreature(*m_creature, *itr);
//Creature* pCrystal = (Unit::GetCreature(*me, FelCrystals[i]));
Creature* pCrystal = Unit::GetCreature(*me, *itr);
if (pCrystal && pCrystal->isAlive())
pCrystal->Kill(pCrystal);
}
@@ -180,7 +180,7 @@ struct boss_selin_fireheartAI : public ScriptedAI
void EnterCombat(Unit* who)
{
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
if (pInstance)
pInstance->HandleGameObject(pInstance->GetData64(DATA_SELIN_ENCOUNTER_DOOR), false);
@@ -189,20 +189,20 @@ struct boss_selin_fireheartAI : public ScriptedAI
void KilledUnit(Unit* victim)
{
DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), m_creature);
DoScriptText(RAND(SAY_KILL_1,SAY_KILL_2), me);
}
void MovementInform(uint32 type, uint32 id)
{
if (type == POINT_MOTION_TYPE && id == 1)
{
Unit* CrystalChosen = Unit::GetUnit(*m_creature, CrystalGUID);
Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID);
if (CrystalChosen && CrystalChosen->isAlive())
{
// Make the crystal attackable
// We also remove NON_ATTACKABLE in case the database has it set.
CrystalChosen->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
CrystalChosen->CastSpell(m_creature, SPELL_MANA_RAGE, true);
CrystalChosen->CastSpell(me, SPELL_MANA_RAGE, true);
IsDraining = true;
}
else
@@ -216,7 +216,7 @@ struct boss_selin_fireheartAI : public ScriptedAI
void JustDied(Unit* killer)
{
DoScriptText(SAY_DEATH, m_creature);
DoScriptText(SAY_DEATH, me);
if (!pInstance)
return;
@@ -234,8 +234,8 @@ struct boss_selin_fireheartAI : public ScriptedAI
if (!DrainingCrystal)
{
uint32 maxPowerMana = m_creature->GetMaxPower(POWER_MANA);
if (maxPowerMana && ((m_creature->GetPower(POWER_MANA)*100 / maxPowerMana) < 10))
uint32 maxPowerMana = me->GetMaxPower(POWER_MANA);
if (maxPowerMana && ((me->GetPower(POWER_MANA)*100 / maxPowerMana) < 10))
{
if (DrainLifeTimer <= diff)
{
@@ -256,16 +256,16 @@ struct boss_selin_fireheartAI : public ScriptedAI
if (FelExplosionTimer <= diff)
{
if (!m_creature->IsNonMeleeSpellCasted(false))
if (!me->IsNonMeleeSpellCasted(false))
{
DoCast(m_creature, SPELL_FEL_EXPLOSION);
DoCast(me, SPELL_FEL_EXPLOSION);
FelExplosionTimer = 2000;
}
} else FelExplosionTimer -= diff;
// If below 10% mana, start recharging
maxPowerMana = m_creature->GetMaxPower(POWER_MANA);
if (maxPowerMana && ((m_creature->GetPower(POWER_MANA)*100 / maxPowerMana) < 10))
maxPowerMana = me->GetMaxPower(POWER_MANA);
if (maxPowerMana && ((me->GetPower(POWER_MANA)*100 / maxPowerMana) < 10))
{
if (DrainCrystalTimer <= diff)
{
@@ -286,17 +286,17 @@ struct boss_selin_fireheartAI : public ScriptedAI
IsDraining = false;
DrainingCrystal = false;
DoScriptText(SAY_EMPOWERED, m_creature);
DoScriptText(SAY_EMPOWERED, me);
Unit* CrystalChosen = Unit::GetUnit(*m_creature, CrystalGUID);
Unit* CrystalChosen = Unit::GetUnit(*me, CrystalGUID);
if (CrystalChosen && CrystalChosen->isAlive())
// Use Deal Damage to kill it, not setDeathState.
CrystalChosen->Kill(CrystalChosen);
CrystalGUID = 0;
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim());
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveChase(me->getVictim());
} else EmpowerTimer -= diff;
}
}
@@ -322,12 +322,12 @@ struct mob_fel_crystalAI : public ScriptedAI
void JustDied(Unit* killer)
{
if (ScriptedInstance* pInstance = m_creature->GetInstanceData())
if (ScriptedInstance* pInstance = me->GetInstanceData())
{
Creature* Selin = (Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_SELIN)));
Creature* Selin = (Unit::GetCreature(*me, pInstance->GetData64(DATA_SELIN)));
if (Selin && Selin->isAlive())
{
if (CAST_AI(boss_selin_fireheartAI, Selin->AI())->CrystalGUID == m_creature->GetGUID())
if (CAST_AI(boss_selin_fireheartAI, Selin->AI())->CrystalGUID == me->GetGUID())
{
// Set this to false if we are the Creature that Selin is draining so his AI flows properly
CAST_AI(boss_selin_fireheartAI, Selin->AI())->DrainingCrystal = false;
@@ -86,7 +86,7 @@ struct boss_vexallusAI : public ScriptedAI
void KilledUnit(Unit *victim)
{
DoScriptText(SAY_KILL, m_creature);
DoScriptText(SAY_KILL, me);
}
void JustDied(Unit *victim)
@@ -97,7 +97,7 @@ struct boss_vexallusAI : public ScriptedAI
void EnterCombat(Unit *who)
{
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
if (pInstance)
pInstance->SetData(DATA_VEXALLUS_EVENT, IN_PROGRESS);
@@ -109,7 +109,7 @@ struct boss_vexallusAI : public ScriptedAI
summoned->GetMotionMaster()->MoveFollow(temp,0,0);
//spells are SUMMON_TYPE_GUARDIAN, so using setOwner should be ok
summoned->CastSpell(summoned,SPELL_ENERGY_BOLT,false,0,0,m_creature->GetGUID());
summoned->CastSpell(summoned,SPELL_ENERGY_BOLT,false,0,0,me->GetGUID());
}
void UpdateAI(const uint32 diff)
@@ -120,7 +120,7 @@ struct boss_vexallusAI : public ScriptedAI
if (!Enraged)
{
//used for check, when Vexallus cast adds 85%, 70%, 55%, 40%, 25%
if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(INTERVAL_MODIFIER*IntervalHealthAmount)))
if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(INTERVAL_MODIFIER*IntervalHealthAmount)))
{
//increase amount, unless we're at 10%, then we switch and return
if (IntervalHealthAmount == INTERVAL_SWITCH)
@@ -131,22 +131,22 @@ struct boss_vexallusAI : public ScriptedAI
else
++IntervalHealthAmount;
DoScriptText(SAY_ENERGY, m_creature);
DoScriptText(EMOTE_DISCHARGE_ENERGY, m_creature);
DoScriptText(SAY_ENERGY, me);
DoScriptText(EMOTE_DISCHARGE_ENERGY, me);
if (IsHeroic())
{
DoCast(m_creature, H_SPELL_SUMMON_PURE_ENERGY1, false);
DoCast(m_creature, H_SPELL_SUMMON_PURE_ENERGY2, false);
DoCast(me, H_SPELL_SUMMON_PURE_ENERGY1, false);
DoCast(me, H_SPELL_SUMMON_PURE_ENERGY2, false);
}
else
DoCast(m_creature, SPELL_SUMMON_PURE_ENERGY, false);
DoCast(me, SPELL_SUMMON_PURE_ENERGY, false);
//below are workaround summons, remove when summoning spells w/implicitTarget 73 implemented in the core
m_creature->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
me->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
if (IsHeroic())
m_creature->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
me->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
}
if (ChainLightningTimer <= diff)
@@ -170,7 +170,7 @@ struct boss_vexallusAI : public ScriptedAI
{
if (OverloadTimer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_OVERLOAD);
DoCast(me->getVictim(), SPELL_OVERLOAD);
OverloadTimer = 2000;
} else OverloadTimer -= diff;
@@ -193,7 +193,7 @@ struct mob_pure_energyAI : public ScriptedAI
void JustDied(Unit* slayer)
{
if (Unit *temp = m_creature->GetOwner())
if (Unit *temp = me->GetOwner())
{
if (temp && temp->isAlive())
slayer->CastSpell(slayer, SPELL_ENERGY_FEEDBACK, true, 0, 0, temp->GetGUID());
@@ -60,8 +60,8 @@ struct npc_kalecgosAI : public ScriptedAI
m_uiTransformTimer = 0;
// we must assume he appear as dragon somewhere outside the platform of orb, and then move directly to here
if (m_creature->GetEntry() != NPC_KAEL)
m_creature->GetMotionMaster()->MovePoint(POINT_ID_LAND, afKaelLandPoint[0], afKaelLandPoint[1], afKaelLandPoint[2]);
if (me->GetEntry() != NPC_KAEL)
me->GetMotionMaster()->MovePoint(POINT_ID_LAND, afKaelLandPoint[0], afKaelLandPoint[1], afKaelLandPoint[2]);
}
void MovementInform(uint32 uiType, uint32 uiPointId)
@@ -76,7 +76,7 @@ struct npc_kalecgosAI : public ScriptedAI
// some targeting issues with the spell, so use this workaround as temporary solution
void DoWorkaroundForQuestCredit()
{
Map* pMap = m_creature->GetMap();
Map* pMap = me->GetMap();
if (!pMap || pMap->IsHeroic())
return;
@@ -104,12 +104,12 @@ struct npc_kalecgosAI : public ScriptedAI
{
if (m_uiTransformTimer <= uiDiff)
{
DoCast(m_creature, SPELL_ORB_KILL_CREDIT, false);
DoCast(me, SPELL_ORB_KILL_CREDIT, false);
DoWorkaroundForQuestCredit();
// Transform and update entry, now ready for quest/read gossip
DoCast(m_creature, SPELL_TRANSFORM_TO_KAEL, false);
m_creature->UpdateEntry(NPC_KAEL);
DoCast(me, SPELL_TRANSFORM_TO_KAEL, false);
me->UpdateEntry(NPC_KAEL);
m_uiTransformTimer = 0;
} else m_uiTransformTimer -= uiDiff;
@@ -55,18 +55,18 @@ struct boss_baron_geddonAI : public ScriptedAI
return;
//If we are <2% hp cast Armageddom
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 2)
if (me->GetHealth()*100 / me->GetMaxHealth() <= 2)
{
m_creature->InterruptNonMeleeSpells(true);
DoCast(m_creature, SPELL_ARMAGEDDOM);
DoScriptText(EMOTE_SERVICE, m_creature);
me->InterruptNonMeleeSpells(true);
DoCast(me, SPELL_ARMAGEDDOM);
DoScriptText(EMOTE_SERVICE, me);
return;
}
//Inferno_Timer
if (Inferno_Timer <= diff)
{
DoCast(m_creature, SPELL_INFERNO);
DoCast(me, SPELL_INFERNO);
Inferno_Timer = 45000;
} else Inferno_Timer -= diff;
@@ -61,14 +61,14 @@ struct boss_garrAI : public ScriptedAI
//AntiMagicPulse_Timer
if (AntiMagicPulse_Timer <= diff)
{
DoCast(m_creature, SPELL_ANTIMAGICPULSE);
DoCast(me, SPELL_ANTIMAGICPULSE);
AntiMagicPulse_Timer = 10000 + rand()%5000;
} else AntiMagicPulse_Timer -= diff;
//MagmaShackles_Timer
if (MagmaShackles_Timer <= diff)
{
DoCast(m_creature, SPELL_MAGMASHACKLES);
DoCast(me, SPELL_MAGMASHACKLES);
MagmaShackles_Timer = 8000 + rand()%4000;
} else MagmaShackles_Timer -= diff;
@@ -106,11 +106,11 @@ struct mob_fireswornAI : public ScriptedAI
} else Immolate_Timer -= diff;
//Cast Erruption and let them die
if (m_creature->GetHealth() <= m_creature->GetMaxHealth() * 0.10)
if (me->GetHealth() <= me->GetMaxHealth() * 0.10)
{
DoCast(m_creature->getVictim(), SPELL_ERUPTION);
m_creature->setDeathState(JUST_DIED);
m_creature->RemoveCorpse();
DoCast(me->getVictim(), SPELL_ERUPTION);
me->setDeathState(JUST_DIED);
me->RemoveCorpse();
}
DoMeleeAttackIfReady();
@@ -70,7 +70,7 @@ struct boss_gehennasAI : public ScriptedAI
//GehennasCurse_Timer
if (GehennasCurse_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_GEHENNASCURSE);
DoCast(me->getVictim(), SPELL_GEHENNASCURSE);
GehennasCurse_Timer = urand(22000,30000);
} else GehennasCurse_Timer -= diff;
@@ -58,7 +58,7 @@ struct boss_golemaggAI : public ScriptedAI
m_uiBuffTimer = 2.5*IN_MILISECONDS;
m_bEnraged = false;
DoCast(m_creature, SPELL_MAGMASPLASH, true);
DoCast(me, SPELL_MAGMASPLASH, true);
}
void JustDied(Unit* pKiller)
@@ -84,9 +84,9 @@ struct boss_golemaggAI : public ScriptedAI
m_uiPyroblastTimer -= uiDiff;
// Enrage
if (!m_bEnraged && m_creature->GetHealth()*100 < m_creature->GetMaxHealth()*10)
if (!m_bEnraged && me->GetHealth()*100 < me->GetMaxHealth()*10)
{
DoCast(m_creature, SPELL_ENRAGE);
DoCast(me, SPELL_ENRAGE);
m_bEnraged = true;
}
@@ -95,7 +95,7 @@ struct boss_golemaggAI : public ScriptedAI
{
if (m_uiEarthquakeTimer <= uiDiff)
{
DoCast(m_creature->getVictim(), SPELL_EARTHQUAKE);
DoCast(me->getVictim(), SPELL_EARTHQUAKE);
m_uiEarthquakeTimer = 3*IN_MILISECONDS;
}
else
@@ -106,7 +106,7 @@ struct boss_golemaggAI : public ScriptedAI
// Golemagg's Trust
if (m_uiBuffTimer <= uidiff)
{
DoCast(m_creature, SPELL_GOLEMAGG_TRUST);
DoCast(me, SPELL_GOLEMAGG_TRUST);
m_uiBuffTimer = 2.5*IN_MILISECONDS;
}
else
@@ -135,7 +135,7 @@ struct mob_core_ragerAI : public ScriptedAI
void DamageTaken(Unit* pDoneBy, uint32& uiDamage)
{
if (m_creature->GetHealth()*100 < m_creature->GetMaxHealth()*50)
if (me->GetHealth()*100 < me->GetMaxHealth()*50)
{
if (m_pInstance)
{
@@ -143,11 +143,11 @@ struct mob_core_ragerAI : public ScriptedAI
{
if (pGolemagg->isAlive())
{
DoScriptText(EMOTE_LOWHP, m_creature);
m_creature->SetHealth(m_creature->GetMaxHealth());
DoScriptText(EMOTE_LOWHP, me);
me->SetHealth(me->GetMaxHealth());
}
else
uiDamage = m_creature->GetHealth();
uiDamage = me->GetHealth();
}
}
}
@@ -161,7 +161,7 @@ struct mob_core_ragerAI : public ScriptedAI
// Mangle
if (m_uiMangleTimer <= uiDiff)
{
DoCast(m_creature->getVictim(), SPELL_MANGLE);
DoCast(me->getVictim(), SPELL_MANGLE);
m_uiMangleTimer = 10*IN_MILISECONDS;
}
else
@@ -54,21 +54,21 @@ struct boss_lucifronAI : public ScriptedAI
//Impending doom timer
if (ImpendingDoom_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_IMPENDINGDOOM);
DoCast(me->getVictim(), SPELL_IMPENDINGDOOM);
ImpendingDoom_Timer = 20000;
} else ImpendingDoom_Timer -= diff;
//Lucifron's curse timer
if (LucifronCurse_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_LUCIFRONCURSE);
DoCast(me->getVictim(), SPELL_LUCIFRONCURSE);
LucifronCurse_Timer = 15000;
} else LucifronCurse_Timer -= diff;
//Shadowshock
if (ShadowShock_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHADOWSHOCK);
DoCast(me->getVictim(), SPELL_SHADOWSHOCK);
ShadowShock_Timer = 6000;
} else ShadowShock_Timer -= diff;
@@ -45,7 +45,7 @@ struct boss_magmadarAI : public ScriptedAI
Panic_Timer = 20000;
Lavabomb_Timer = 12000;
DoCast(m_creature, SPELL_MAGMASPIT, true);
DoCast(me, SPELL_MAGMASPIT, true);
}
void EnterCombat(Unit *who)
@@ -60,15 +60,15 @@ struct boss_magmadarAI : public ScriptedAI
//Frenzy_Timer
if (Frenzy_Timer <= diff)
{
DoScriptText(EMOTE_FRENZY, m_creature);
DoCast(m_creature, SPELL_FRENZY);
DoScriptText(EMOTE_FRENZY, me);
DoCast(me, SPELL_FRENZY);
Frenzy_Timer = 15000;
} else Frenzy_Timer -= diff;
//Panic_Timer
if (Panic_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_PANIC);
DoCast(me->getVictim(), SPELL_PANIC);
Panic_Timer = 35000;
} else Panic_Timer -= diff;
@@ -71,12 +71,12 @@ struct boss_majordomoAI : public ScriptedAI
if (rand()%5)
return;
DoScriptText(SAY_SLAY, m_creature);
DoScriptText(SAY_SLAY, me);
}
void EnterCombat(Unit *who)
{
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
}
void UpdateAI(const uint32 diff)
@@ -85,15 +85,15 @@ struct boss_majordomoAI : public ScriptedAI
return;
//Cast Ageis if less than 50% hp
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 50)
if (me->GetHealth()*100 / me->GetMaxHealth() < 50)
{
DoCast(m_creature, SPELL_AEGIS);
DoCast(me, SPELL_AEGIS);
}
//MagicReflection_Timer
// if (MagicReflection_Timer <= diff)
// {
// DoCast(m_creature, SPELL_MAGICREFLECTION);
// DoCast(me, SPELL_MAGICREFLECTION);
//60 seconds until we should cast this agian
// MagicReflection_Timer = 30000;
@@ -102,7 +102,7 @@ struct boss_majordomoAI : public ScriptedAI
//DamageReflection_Timer
// if (DamageReflection_Timer <= diff)
// {
// DoCast(m_creature, SPELL_DAMAGEREFLECTION);
// DoCast(me, SPELL_DAMAGEREFLECTION);
//60 seconds until we should cast this agian
// DamageReflection_Timer = 30000;
@@ -111,7 +111,7 @@ struct boss_majordomoAI : public ScriptedAI
//Blastwave_Timer
if (Blastwave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_BLASTWAVE);
DoCast(me->getVictim(), SPELL_BLASTWAVE);
Blastwave_Timer = 10000;
} else Blastwave_Timer -= diff;
@@ -118,7 +118,7 @@ struct boss_ragnarosAI : public ScriptedAI
HasSubmergedOnce = false;
WasBanished = false;
DoCast(m_creature, SPELL_MELTWEAPON, true);
DoCast(me, SPELL_MELTWEAPON, true);
HasAura = true;
}
@@ -127,7 +127,7 @@ struct boss_ragnarosAI : public ScriptedAI
if (rand()%5)
return;
DoScriptText(SAY_KILL, m_creature);
DoScriptText(SAY_KILL, me);
}
void EnterCombat(Unit *who)
@@ -139,9 +139,9 @@ struct boss_ragnarosAI : public ScriptedAI
if (WasBanished && Attack_Timer <= diff)
{
//Become unbanished again
m_creature->setFaction(14);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
DoCast(m_creature, SPELL_RAGEMERGE);
me->setFaction(14);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
DoCast(me, SPELL_RAGEMERGE);
WasBanished = false;
} else if (WasBanished)
{
@@ -157,10 +157,10 @@ struct boss_ragnarosAI : public ScriptedAI
//WrathOfRagnaros_Timer
if (WrathOfRagnaros_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_WRATHOFRAGNAROS);
DoCast(me->getVictim(), SPELL_WRATHOFRAGNAROS);
if (urand(0,1))
DoScriptText(SAY_WRATH, m_creature);
DoScriptText(SAY_WRATH, me);
WrathOfRagnaros_Timer = 30000;
} else WrathOfRagnaros_Timer -= diff;
@@ -168,10 +168,10 @@ struct boss_ragnarosAI : public ScriptedAI
//HandOfRagnaros_Timer
if (HandOfRagnaros_Timer <= diff)
{
DoCast(m_creature, SPELL_HANDOFRAGNAROS);
DoCast(me, SPELL_HANDOFRAGNAROS);
if (urand(0,1))
DoScriptText(SAY_HAND, m_creature);
DoScriptText(SAY_HAND, me);
HandOfRagnaros_Timer = 25000;
} else HandOfRagnaros_Timer -= diff;
@@ -179,21 +179,21 @@ struct boss_ragnarosAI : public ScriptedAI
//LavaBurst_Timer
if (LavaBurst_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_LAVABURST);
DoCast(me->getVictim(), SPELL_LAVABURST);
LavaBurst_Timer = 10000;
} else LavaBurst_Timer -= diff;
//Erruption_Timer
if (LavaBurst_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_ERRUPTION);
DoCast(me->getVictim(), SPELL_ERRUPTION);
Erruption_Timer = urand(20000,45000);
} else Erruption_Timer -= diff;
//ElementalFire_Timer
if (ElementalFire_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_ELEMENTALFIRE);
DoCast(me->getVictim(), SPELL_ELEMENTALFIRE);
ElementalFire_Timer = urand(10000,14000);
} else ElementalFire_Timer -= diff;
@@ -204,48 +204,48 @@ struct boss_ragnarosAI : public ScriptedAI
//is not very well supported in the core
//so added normaly spawning and banish workaround and attack again after 90 secs.
m_creature->InterruptNonMeleeSpells(false);
me->InterruptNonMeleeSpells(false);
//Root self
DoCast(m_creature, 23973);
m_creature->setFaction(35);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);
DoCast(me, 23973);
me->setFaction(35);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE);
if (!HasSubmergedOnce)
{
DoScriptText(SAY_REINFORCEMENTS1, m_creature);
DoScriptText(SAY_REINFORCEMENTS1, me);
// summon 10 elementals
for (uint8 i = 0; i < 9; ++i)
{
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
{
if (Creature* pSummoned = m_creature->SummonCreature(12143,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0.0f,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,900000))
if (Creature* pSummoned = me->SummonCreature(12143,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0.0f,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,900000))
pSummoned->AI()->AttackStart(pTarget);
}
}
HasSubmergedOnce = true;
WasBanished = true;
DoCast(m_creature, SPELL_RAGSUBMERGE);
DoCast(me, SPELL_RAGSUBMERGE);
Attack_Timer = 90000;
}
else
{
DoScriptText(SAY_REINFORCEMENTS2, m_creature);
DoScriptText(SAY_REINFORCEMENTS2, me);
for (uint8 i = 0; i < 9; ++i)
{
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
{
if (Creature* pSummoned = m_creature->SummonCreature(12143,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0.0f,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,900000))
if (Creature* pSummoned = me->SummonCreature(12143,pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(),0.0f,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,900000))
pSummoned->AI()->AttackStart(pTarget);
}
}
WasBanished = true;
DoCast(m_creature, SPELL_RAGSUBMERGE);
DoCast(me, SPELL_RAGSUBMERGE);
Attack_Timer = 90000;
}
@@ -253,13 +253,13 @@ struct boss_ragnarosAI : public ScriptedAI
} else Submerge_Timer -= diff;
//If we are within range melee the target
if (m_creature->IsWithinMeleeRange(m_creature->getVictim()))
if (me->IsWithinMeleeRange(me->getVictim()))
{
//Make sure our attack is ready and we arn't currently casting
if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false))
if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false))
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
me->AttackerStateUpdate(me->getVictim());
me->resetAttackTimer();
}
}
else
@@ -267,12 +267,12 @@ struct boss_ragnarosAI : public ScriptedAI
//MagmaBurst_Timer
if (MagmaBurst_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_MAGMABURST);
DoCast(me->getVictim(), SPELL_MAGMABURST);
if (!HasYelledMagmaBurst)
{
//Say our dialog
DoScriptText(SAY_MAGMABURST, m_creature);
DoScriptText(SAY_MAGMABURST, me);
HasYelledMagmaBurst = true;
}
@@ -59,7 +59,7 @@ struct boss_shazzrahAI : public ScriptedAI
//ArcaneExplosion_Timer
if (ArcaneExplosion_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_ARCANEEXPLOSION);
DoCast(me->getVictim(), SPELL_ARCANEEXPLOSION);
ArcaneExplosion_Timer = 5000 + rand()%4000;
} else ArcaneExplosion_Timer -= diff;
@@ -76,14 +76,14 @@ struct boss_shazzrahAI : public ScriptedAI
//DeadenMagic_Timer
if (DeadenMagic_Timer <= diff)
{
DoCast(m_creature, SPELL_DEADENMAGIC);
DoCast(me, SPELL_DEADENMAGIC);
DeadenMagic_Timer = 35000;
} else DeadenMagic_Timer -= diff;
//Countspell_Timer
if (Countspell_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_COUNTERSPELL);
DoCast(me->getVictim(), SPELL_COUNTERSPELL);
Countspell_Timer = 16000 + rand()%4000;
} else Countspell_Timer -= diff;
@@ -66,7 +66,7 @@ struct boss_sulfuronAI : public ScriptedAI
//DemoralizingShout_Timer
if (DemoralizingShout_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_DEMORALIZINGSHOUT);
DoCast(me->getVictim(), SPELL_DEMORALIZINGSHOUT);
DemoralizingShout_Timer = 15000 + rand()%5000;
} else DemoralizingShout_Timer -= diff;
@@ -85,7 +85,7 @@ struct boss_sulfuronAI : public ScriptedAI
if (pTarget)
DoCast(pTarget, SPELL_INSPIRE);
DoCast(m_creature, SPELL_INSPIRE);
DoCast(me, SPELL_INSPIRE);
Inspire_Timer = 20000 + rand()%6000;
} else Inspire_Timer -= diff;
@@ -93,7 +93,7 @@ struct boss_sulfuronAI : public ScriptedAI
//Knockdown_Timer
if (Knockdown_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_KNOCKDOWN);
DoCast(me->getVictim(), SPELL_KNOCKDOWN);
Knockdown_Timer = 12000 + rand()%3000;
} else Knockdown_Timer -= diff;
@@ -110,7 +110,7 @@ struct boss_sulfuronAI : public ScriptedAI
//DarkStrike_Timer
if (Darkstrike_Timer <= diff)
{
DoCast(m_creature, SPELL_DARKSTRIKE);
DoCast(me, SPELL_DARKSTRIKE);
Darkstrike_Timer = 15000 + rand()%3000;
} else Darkstrike_Timer -= diff;
@@ -62,8 +62,8 @@ struct npc_corporal_keeshanAI : public npc_escortAI
if (!pPlayer)
return;
if (uiI >= 65 && m_creature->GetUnitMovementFlags() == MOVEMENTFLAG_WALK_MODE)
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
if (uiI >= 65 && me->GetUnitMovementFlags() == MOVEMENTFLAG_WALK_MODE)
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
switch(uiI)
{
@@ -73,7 +73,7 @@ struct npc_corporal_keeshanAI : public npc_escortAI
uiPhase = 1;
break;
case 65:
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
break;
case 115:
pPlayer->AreaExploredOrEventHappens(QUEST_MISSING_IN_ACTION);
@@ -97,28 +97,28 @@ struct npc_corporal_keeshanAI : public npc_escortAI
switch(uiPhase)
{
case 1:
m_creature->SetStandState(UNIT_STAND_STATE_SIT);
me->SetStandState(UNIT_STAND_STATE_SIT);
uiTimer = 1000;
uiPhase = 2;
break;
case 2:
DoScriptText(SAY_CORPORAL_2,m_creature);
DoScriptText(SAY_CORPORAL_2,me);
uiTimer = 15000;
uiPhase = 3;
break;
case 3:
DoScriptText(SAY_CORPORAL_3,m_creature);
m_creature->SetStandState(UNIT_STAND_STATE_STAND);
DoScriptText(SAY_CORPORAL_3,me);
me->SetStandState(UNIT_STAND_STATE_STAND);
SetEscortPaused(false);
uiTimer = 0;
uiPhase = 0;
break;
case 4:
DoScriptText(SAY_CORPORAL_4, m_creature);
DoScriptText(SAY_CORPORAL_4, me);
uiTimer = 2500;
uiPhase = 5;
case 5:
DoScriptText(SAY_CORPORAL_5, m_creature);
DoScriptText(SAY_CORPORAL_5, me);
uiTimer = 0;
uiPhase = 0;
}
@@ -130,13 +130,13 @@ struct npc_corporal_keeshanAI : public npc_escortAI
if (uiMockingBlowTimer <= uiDiff)
{
DoCast(m_creature->getVictim(),SPELL_MOCKING_BLOW);
DoCast(me->getVictim(),SPELL_MOCKING_BLOW);
uiMockingBlowTimer = 5000;
} else uiMockingBlowTimer -= uiDiff;
if (uiShieldBashTimer <= uiDiff)
{
DoCast(m_creature->getVictim(),SPELL_MOCKING_BLOW);
DoCast(me->getVictim(),SPELL_MOCKING_BLOW);
uiShieldBashTimer = 8000;
} else uiShieldBashTimer -= uiDiff;
@@ -355,7 +355,7 @@ struct npc_death_knight_initiateAI : public CombatAI
me->RestoreFaction();
CombatAI::Reset();
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15);
m_uiDuelerGUID = 0;
m_uiDuelTimer = 5000;
@@ -377,7 +377,7 @@ struct npc_death_knight_initiateAI : public CombatAI
{
if (pDoneBy->GetGUID() != m_uiDuelerGUID && pDoneBy->GetOwnerGUID() != m_uiDuelerGUID) // other players cannot help
uiDamage = 0;
else if (uiDamage >= m_creature->GetHealth())
else if (uiDamage >= me->GetHealth())
{
uiDamage = 0;
@@ -402,9 +402,9 @@ struct npc_death_knight_initiateAI : public CombatAI
{
if (m_uiDuelTimer <= uiDiff)
{
m_creature->setFaction(FACTION_HOSTILE);
me->setFaction(FACTION_HOSTILE);
if (Unit* pUnit = Unit::GetUnit(*m_creature, m_uiDuelerGUID))
if (Unit* pUnit = Unit::GetUnit(*me, m_uiDuelerGUID))
AttackStart(pUnit);
}
else
@@ -519,23 +519,23 @@ struct npc_dark_rider_of_acherusAI : public ScriptedAI
switch(Phase)
{
case 0:
m_creature->MonsterSay(SAY_DARK_RIDER, LANG_UNIVERSAL, 0);
me->MonsterSay(SAY_DARK_RIDER, LANG_UNIVERSAL, 0);
PhaseTimer = 5000;
Phase = 1;
break;
case 1:
if (Unit *pTarget = Unit::GetUnit(*m_creature, TargetGUID))
if (Unit *pTarget = Unit::GetUnit(*me, TargetGUID))
DoCast(pTarget, DESPAWN_HORSE, true);
PhaseTimer = 3000;
Phase = 2;
break;
case 2:
m_creature->SetVisibility(VISIBILITY_OFF);
me->SetVisibility(VISIBILITY_OFF);
PhaseTimer = 2000;
Phase = 3;
break;
case 3:
m_creature->ForcedDespawn();
me->ForcedDespawn();
break;
default:
break;
@@ -550,10 +550,10 @@ struct npc_dark_rider_of_acherusAI : public ScriptedAI
return;
TargetGUID = who->GetGUID();
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
m_creature->SetSpeed(MOVE_RUN, 0.4f);
m_creature->GetMotionMaster()->MoveChase(who);
m_creature->SetUInt64Value(UNIT_FIELD_TARGET, TargetGUID);
me->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
me->SetSpeed(MOVE_RUN, 0.4f);
me->GetMotionMaster()->MoveChase(who);
me->SetUInt64Value(UNIT_FIELD_TARGET, TargetGUID);
Intro = true;
}
@@ -593,7 +593,7 @@ struct npc_salanar_the_horsemanAI : public ScriptedAI
caster->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
caster->setFaction(35);
DoCast(caster, CALL_DARK_RIDER, true);
if (Creature* Dark_Rider = m_creature->FindNearestCreature(28654, 15))
if (Creature* Dark_Rider = me->FindNearestCreature(28654, 15))
CAST_AI(npc_dark_rider_of_acherusAI, Dark_Rider->AI())->InitDespawnHorse(caster);
}
}
@@ -723,9 +723,9 @@ struct npc_scarlet_ghoulAI : public ScriptedAI
{
// Ghouls should display their Birth Animation
// Crawling out of the ground
//DoCast(m_creature, 35177, true);
//m_creature->MonsterSay("Mommy?",LANG_UNIVERSAL,0);
m_creature->SetReactState(REACT_DEFENSIVE);
//DoCast(me, 35177, true);
//me->MonsterSay("Mommy?",LANG_UNIVERSAL,0);
me->SetReactState(REACT_DEFENSIVE);
}
void FindMinions(Unit *owner)
@@ -737,7 +737,7 @@ struct npc_scarlet_ghoulAI : public ScriptedAI
{
for (std::list<Creature*>::const_iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr)
{
if (CAST_CRE(*itr)->GetOwner()->GetGUID() == m_creature->GetOwner()->GetGUID())
if (CAST_CRE(*itr)->GetOwner()->GetGUID() == me->GetOwner()->GetGUID())
{
if (CAST_CRE(*itr)->isInCombat() && CAST_CRE(*itr)->getAttackerForHelper())
{
@@ -750,9 +750,9 @@ struct npc_scarlet_ghoulAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
if (!m_creature->isInCombat())
if (!me->isInCombat())
{
if (Unit *owner = m_creature->GetOwner())
if (Unit *owner = me->GetOwner())
{
if (owner->GetTypeId() == TYPEID_PLAYER && CAST_PLR(owner)->isInCombat())
{
@@ -773,15 +773,15 @@ struct npc_scarlet_ghoulAI : public ScriptedAI
//ScriptedAI::UpdateAI(diff);
//Check if we have a current target
if (m_creature->getVictim()->GetEntry() == GHOSTS)
if (me->getVictim()->GetEntry() == GHOSTS)
{
if (m_creature->isAttackReady())
if (me->isAttackReady())
{
//If we are within range melee the target
if (m_creature->IsWithinMeleeRange(m_creature->getVictim()))
if (me->IsWithinMeleeRange(me->getVictim()))
{
m_creature->AttackerStateUpdate(m_creature->getVictim());
m_creature->resetAttackTimer();
me->AttackerStateUpdate(me->getVictim());
me->resetAttackTimer();
}
}
}
@@ -35,16 +35,16 @@ struct npc_valkyr_battle_maidenAI : public PassiveAI
void Reset()
{
me->setActive(true);
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->SetFlying(true);
me->SetVisibility(VISIBILITY_OFF);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetFlying(true);
FlyBackTimer = 500;
phase = 0;
m_creature->GetPosition(x, y, z);
me->GetPosition(x, y, z);
z += 4; x -= 3.5; y -= 5;
m_creature->GetMotionMaster()->Clear(false);
m_creature->GetMap()->CreatureRelocation(m_creature, x, y, z, 0.0f);
me->GetMotionMaster()->Clear(false);
me->GetMap()->CreatureRelocation(me, x, y, z, 0.0f);
}
void UpdateAI(const uint32 diff)
@@ -63,24 +63,24 @@ struct npc_valkyr_battle_maidenAI : public PassiveAI
switch(phase)
{
case 0:
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
m_creature->HandleEmoteCommand(EMOTE_STATE_FLYGRABCLOSED);
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
me->HandleEmoteCommand(EMOTE_STATE_FLYGRABCLOSED);
FlyBackTimer = 500;
break;
case 1:
plr->GetClosePoint(x,y,z, m_creature->GetObjectSize());
plr->GetClosePoint(x,y,z, me->GetObjectSize());
z += 2.5; x -= 2; y -= 1.5;
m_creature->GetMotionMaster()->MovePoint(0, x, y, z);
m_creature->SetUInt64Value(UNIT_FIELD_TARGET, plr->GetGUID());
m_creature->SetVisibility(VISIBILITY_ON);
me->GetMotionMaster()->MovePoint(0, x, y, z);
me->SetUInt64Value(UNIT_FIELD_TARGET, plr->GetGUID());
me->SetVisibility(VISIBILITY_ON);
FlyBackTimer = 4500;
break;
case 2:
if (!plr->isRessurectRequested())
{
m_creature->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOMSPELL01);
me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOMSPELL01);
DoCast(plr, SPELL_REVIVE, true);
m_creature->MonsterWhisper(VALK_WHISPER, plr->GetGUID());
me->MonsterWhisper(VALK_WHISPER, plr->GetGUID());
}
FlyBackTimer = 5000;
break;
@@ -56,7 +56,7 @@ struct boss_arcanist_doanAI : public ScriptedAI
void EnterCombat(Unit *who)
{
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
}
void UpdateAI(const uint32 diff)
@@ -66,22 +66,22 @@ struct boss_arcanist_doanAI : public ScriptedAI
if (bShielded && bCanDetonate)
{
DoCast(m_creature, SPELL_FIREAOE);
DoCast(me, SPELL_FIREAOE);
bCanDetonate = false;
}
if (m_creature->HasAura(SPELL_ARCANEBUBBLE))
if (me->HasAura(SPELL_ARCANEBUBBLE))
return;
//If we are <50% hp cast Arcane Bubble
if (!bShielded && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50)
if (!bShielded && me->GetHealth()*100 / me->GetMaxHealth() <= 50)
{
//wait if we already casting
if (m_creature->IsNonMeleeSpellCasted(false))
if (me->IsNonMeleeSpellCasted(false))
return;
DoScriptText(SAY_SPECIALAE, m_creature);
DoCast(m_creature, SPELL_ARCANEBUBBLE);
DoScriptText(SAY_SPECIALAE, me);
DoCast(me, SPELL_ARCANEBUBBLE);
bCanDetonate = true;
bShielded = true;
@@ -98,14 +98,14 @@ struct boss_arcanist_doanAI : public ScriptedAI
//AoESilence_Timer
if (AoESilence_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_AOESILENCE);
DoCast(me->getVictim(), SPELL_AOESILENCE);
AoESilence_Timer = 15000 + rand()%5000;
} else AoESilence_Timer -= diff;
//ArcaneExplosion_Timer
if (ArcaneExplosion_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_ARCANEEXPLOSION);
DoCast(me->getVictim(), SPELL_ARCANEEXPLOSION);
ArcaneExplosion_Timer = 8000;
} else ArcaneExplosion_Timer -= diff;
@@ -52,12 +52,12 @@ struct boss_azshir_the_sleeplessAI : public ScriptedAI
return;
//If we are <50% hp cast Soul Siphon rank 1
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50 && !m_creature->IsNonMeleeSpellCasted(false))
if (me->GetHealth()*100 / me->GetMaxHealth() <= 50 && !me->IsNonMeleeSpellCasted(false))
{
//SoulSiphon_Timer
if (SoulSiphon_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SOULSIPHON);
DoCast(me->getVictim(), SPELL_SOULSIPHON);
return;
SoulSiphon_Timer = 20000;
@@ -67,14 +67,14 @@ struct boss_azshir_the_sleeplessAI : public ScriptedAI
//CallOfTheGrave_Timer
if (CallOftheGrave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CALLOFTHEGRAVE);
DoCast(me->getVictim(), SPELL_CALLOFTHEGRAVE);
CallOftheGrave_Timer = 30000;
} else CallOftheGrave_Timer -= diff;
//Terrify_Timer
if (Terrify_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_TERRIFY);
DoCast(me->getVictim(), SPELL_TERRIFY);
Terrify_Timer = 20000;
} else Terrify_Timer -= diff;
@@ -56,12 +56,12 @@ struct boss_bloodmage_thalnosAI : public ScriptedAI
void EnterCombat(Unit *who)
{
DoScriptText(SAY_AGGRO, m_creature);
DoScriptText(SAY_AGGRO, me);
}
void KilledUnit(Unit* Victim)
{
DoScriptText(SAY_KILL, m_creature);
DoScriptText(SAY_KILL, me);
}
void UpdateAI(const uint32 diff)
@@ -70,37 +70,37 @@ struct boss_bloodmage_thalnosAI : public ScriptedAI
return;
//If we are <35% hp
if (!HpYell && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() <= 35))
if (!HpYell && ((me->GetHealth()*100) / me->GetMaxHealth() <= 35))
{
DoScriptText(SAY_HEALTH, m_creature);
DoScriptText(SAY_HEALTH, me);
HpYell = true;
}
//FlameShock_Timer
if (FlameShock_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FLAMESHOCK);
DoCast(me->getVictim(), SPELL_FLAMESHOCK);
FlameShock_Timer = 10000 + rand()%5000;
} else FlameShock_Timer -= diff;
//FlameSpike_Timer
if (FlameSpike_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FLAMESPIKE);
DoCast(me->getVictim(), SPELL_FLAMESPIKE);
FlameSpike_Timer = 30000;
} else FlameSpike_Timer -= diff;
//FireNova_Timer
if (FireNova_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_FIRENOVA);
DoCast(me->getVictim(), SPELL_FIRENOVA);
FireNova_Timer = 40000;
} else FireNova_Timer -= diff;
//ShadowBolt_Timer
if (ShadowBolt_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_SHADOWBOLT);
DoCast(me->getVictim(), SPELL_SHADOWBOLT);
ShadowBolt_Timer = 2000;
} else ShadowBolt_Timer -= diff;
@@ -173,13 +173,13 @@ struct mob_wisp_invisAI : public ScriptedAI
break;
}
if (spell)
DoCast(m_creature, spell);
DoCast(me, spell);
}
void SpellHit(Unit* caster, const SpellEntry *spell)
{
if (spell->Id == SPELL_WISP_FLIGHT_PORT && Creaturetype == 4)
m_creature->SetDisplayId(2027);
me->SetDisplayId(2027);
}
void MoveInLineOfSight(Unit *who)
@@ -187,7 +187,7 @@ struct mob_wisp_invisAI : public ScriptedAI
if (!who || Creaturetype != 1 || !who->isTargetableForAttack())
return;
if (m_creature->IsWithinDist(who, 0.1, false) && !who->HasAura(SPELL_SQUASH_SOUL))
if (me->IsWithinDist(who, 0.1, false) && !who->HasAura(SPELL_SQUASH_SOUL))
DoCast(who, SPELL_SQUASH_SOUL);
}
@@ -197,9 +197,9 @@ struct mob_wisp_invisAI : public ScriptedAI
{
if (delay <= diff)
{
m_creature->RemoveAurasDueToSpell(SPELL_SMOKE);
me->RemoveAurasDueToSpell(SPELL_SMOKE);
if (spell2)
DoCast(m_creature, spell2);
DoCast(me, spell2);
delay = 0;
} else delay -= diff;
}
@@ -232,8 +232,8 @@ struct mob_headAI : public ScriptedAI
void EnterCombat(Unit *who) {}
void SaySound(int32 textEntry, Unit *pTarget = 0)
{
DoScriptText(textEntry, m_creature, pTarget);
//DoCast(m_creature, SPELL_HEAD_SPEAKS, true);
DoScriptText(textEntry, me, pTarget);
//DoCast(me, SPELL_HEAD_SPEAKS, true);
Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000);
if (speaker)
speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false);
@@ -248,24 +248,24 @@ struct mob_headAI : public ScriptedAI
switch(Phase)
{
case 1:
if (((m_creature->GetHealth() - damage)*100)/m_creature->GetMaxHealth() < 67)
if (((me->GetHealth() - damage)*100)/me->GetMaxHealth() < 67)
Disappear();
break;
case 2:
if (((m_creature->GetHealth() - damage)*100)/m_creature->GetMaxHealth() < 34)
if (((me->GetHealth() - damage)*100)/me->GetMaxHealth() < 34)
Disappear();
break;
case 3:
if (damage >= m_creature->GetHealth())
if (damage >= me->GetHealth())
{
die = true;
withbody = true;
wait = 300;
damage = m_creature->GetHealth() - m_creature->GetMaxHealth()/100;
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->StopMoving();
//m_creature->GetMotionMaster()->MoveIdle();
DoCast(m_creature, SPELL_HEAD_IS_DEAD);
damage = me->GetHealth() - me->GetMaxHealth()/100;
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->StopMoving();
//me->GetMotionMaster()->MoveIdle();
DoCast(me, SPELL_HEAD_IS_DEAD);
}
break;
}
@@ -283,13 +283,13 @@ struct mob_headAI : public ScriptedAI
withbody = false;
if (!bodyGUID)
bodyGUID = caster->GetGUID();
m_creature->RemoveAllAuras();
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
DoCast(m_creature, SPELL_HEAD_LANDS, true);
DoCast(m_creature, SPELL_HEAD, false);
me->RemoveAllAuras();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
DoCast(me, SPELL_HEAD_LANDS, true);
DoCast(me, SPELL_HEAD, false);
SaySound(SAY_LOST_HEAD);
m_creature->GetMotionMaster()->Clear(false);
m_creature->GetMotionMaster()->MoveFleeing(caster->getVictim());
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveFleeing(caster->getVictim());
}
}
void Disappear();//we must set returned=true(this will prevent from "body calls head" while head flying to body), see function below
@@ -300,20 +300,20 @@ struct mob_headAI : public ScriptedAI
if (wait <= diff)
{
wait = 1000;
if (!m_creature->getVictim()) return;
m_creature->GetMotionMaster()->Clear(false);
m_creature->GetMotionMaster()->MoveFleeing(m_creature->getVictim());
if (!me->getVictim()) return;
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MoveFleeing(me->getVictim());
} else wait -= diff;
if (laugh <= diff)
{
laugh = urand(15000,30000);
DoPlaySoundToSet(m_creature, RandomLaugh[urand(0,2)]);
//DoCast(m_creature, SPELL_HEAD_SPEAKS, true); //this spell remove buff "head"
DoPlaySoundToSet(me, RandomLaugh[urand(0,2)]);
//DoCast(me, SPELL_HEAD_SPEAKS, true); //this spell remove buff "head"
Creature *speaker = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,1000);
if (speaker)
speaker->CastSpell(speaker,SPELL_HEAD_SPEAKS,false);
m_creature->MonsterTextEmote(EMOTE_LAUGHS,NULL);
me->MonsterTextEmote(EMOTE_LAUGHS,NULL);
} else laugh -= diff;
}
else
@@ -323,9 +323,9 @@ struct mob_headAI : public ScriptedAI
if (wait <= diff)
{
die = false;
if (Unit *body = Unit::GetUnit((*m_creature), bodyGUID))
if (Unit *body = Unit::GetUnit((*me), bodyGUID))
body->Kill(body);
m_creature->Kill(m_creature);
me->Kill(me);
} else wait -= diff;
}
}
@@ -397,10 +397,10 @@ struct boss_headless_horsemanAI : public ScriptedAI
returned = true;
burned = false;
IsFlying = false;
DoCast(m_creature, SPELL_HEAD);
DoCast(me, SPELL_HEAD);
if (headGUID)
{
if (Creature* Head = Unit::GetCreature((*m_creature), headGUID))
if (Creature* Head = Unit::GetCreature((*me), headGUID))
Head->DisappearAndDie();
headGUID = 0;
@@ -412,10 +412,10 @@ struct boss_headless_horsemanAI : public ScriptedAI
void FlyMode()
{
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING);
m_creature->SetSpeed(MOVE_WALK,5.0f,true);
me->SetVisibility(VISIBILITY_OFF);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING);
me->SetSpeed(MOVE_WALK,5.0f,true);
wp_reached = false;
count = 0;
say_timer = 3000;
@@ -433,13 +433,13 @@ struct boss_headless_horsemanAI : public ScriptedAI
switch (id)
{
case 0:
m_creature->SetVisibility(VISIBILITY_ON);
me->SetVisibility(VISIBILITY_ON);
break;
case 1:
{
if (Creature *smoke = m_creature->SummonCreature(HELPER,Spawn[1].x,Spawn[1].y,Spawn[1].z,0,TEMPSUMMON_TIMED_DESPAWN,20000))
if (Creature *smoke = me->SummonCreature(HELPER,Spawn[1].x,Spawn[1].y,Spawn[1].z,0,TEMPSUMMON_TIMED_DESPAWN,20000))
CAST_AI(mob_wisp_invisAI, smoke->AI())->SetType(3);
DoCast(m_creature, SPELL_RHYME_BIG);
DoCast(me, SPELL_RHYME_BIG);
break;
}
case 6:
@@ -447,16 +447,16 @@ struct boss_headless_horsemanAI : public ScriptedAI
pInstance->SetData(GAMEOBJECT_PUMPKIN_SHRINE, 0); //hide gameobject
break;
case 19:
m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING);
me->RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT | MOVEMENTFLAG_LEVITATING);
break;
case 20:
{
Phase = 1;
IsFlying = false;
wp_reached = false;
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
SaySound(SAY_ENTRANCE);
if (Unit *plr = Unit::GetUnit((*m_creature),PlayerGUID))
if (Unit *plr = Unit::GetUnit((*me),PlayerGUID))
DoStartMovement(plr);
break;
}
@@ -483,20 +483,20 @@ struct boss_headless_horsemanAI : public ScriptedAI
if (withhead)
SaySound(SAY_PLAYER_DEATH);
//maybe possible when player dies from conflagration
else if (Creature *Head = Unit::GetCreature((*m_creature), headGUID))
else if (Creature *Head = Unit::GetCreature((*me), headGUID))
CAST_AI(mob_headAI, Head->AI())->SaySound(SAY_PLAYER_DEATH);
}
}
void SaySound(int32 textEntry, Unit *pTarget = 0)
{
DoScriptText(textEntry, m_creature, pTarget);
DoScriptText(textEntry, me, pTarget);
laugh += 4000;
}
Player* SelectRandomPlayer(float range = 0.0f, bool checkLoS = true)
{
Map* pMap = m_creature->GetMap();
Map* pMap = me->GetMap();
if (!pMap->IsDungeon()) return NULL;
Map::PlayerList const &PlayerList = pMap->GetPlayers();
@@ -507,8 +507,8 @@ struct boss_headless_horsemanAI : public ScriptedAI
std::list<Player*>::const_iterator j;
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if ((m_creature->IsWithinLOSInMap(i->getSource()) || !checkLoS) && m_creature->getVictim() != i->getSource() &&
m_creature->IsWithinDistInMap(i->getSource(), range) && i->getSource()->isAlive())
if ((me->IsWithinLOSInMap(i->getSource()) || !checkLoS) && me->getVictim() != i->getSource() &&
me->IsWithinDistInMap(i->getSource(), range) && i->getSource()->isAlive())
temp.push_back(i->getSource());
if (temp.size())
@@ -528,8 +528,8 @@ struct boss_headless_horsemanAI : public ScriptedAI
void JustDied(Unit* killer)
{
m_creature->StopMoving();
//m_creature->GetMotionMaster()->MoveIdle();
me->StopMoving();
//me->GetMotionMaster()->MoveIdle();
SaySound(SAY_DEATH);
if (Creature *flame = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_DESPAWN,60000))
flame->CastSpell(flame,SPELL_BODY_FLAME,false);
@@ -551,47 +551,47 @@ struct boss_headless_horsemanAI : public ScriptedAI
else
Phase = 3;
withhead = true;
m_creature->RemoveAllAuras();
m_creature->SetName("Headless Horseman");
m_creature->SetHealth(m_creature->GetMaxHealth());
me->RemoveAllAuras();
me->SetName("Headless Horseman");
me->SetHealth(me->GetMaxHealth());
SaySound(SAY_REJOINED);
DoCast(m_creature, SPELL_HEAD);
DoCast(me, SPELL_HEAD);
caster->GetMotionMaster()->Clear(false);
caster->GetMotionMaster()->MoveFollow(m_creature,6,urand(0,5));
caster->GetMotionMaster()->MoveFollow(me,6,urand(0,5));
//DoResetThreat();//not sure if need
std::list<HostileReference*>::const_iterator itr;
for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && pUnit->isAlive() && pUnit != caster)
m_creature->AddThreat(pUnit,caster->getThreatManager().getThreat(pUnit));
me->AddThreat(pUnit,caster->getThreatManager().getThreat(pUnit));
}
}
}
void DamageTaken(Unit *done_by, uint32 &damage)
{
if (damage >= m_creature->GetHealth() && withhead)
if (damage >= me->GetHealth() && withhead)
{
withhead = false;
returned = false;
damage = m_creature->GetHealth() - m_creature->GetMaxHealth()/100;
m_creature->RemoveAllAuras();
m_creature->SetName("Headless Horseman, Unhorsed");
damage = me->GetHealth() - me->GetMaxHealth()/100;
me->RemoveAllAuras();
me->SetName("Headless Horseman, Unhorsed");
if (!headGUID)
headGUID = DoSpawnCreature(HEAD,rand()%6,rand()%6,0,0,TEMPSUMMON_DEAD_DESPAWN,0)->GetGUID();
Unit* Head = Unit::GetUnit((*m_creature), headGUID);
Unit* Head = Unit::GetUnit((*me), headGUID);
if (Head && Head->isAlive())
{
Head->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
//Head->CastSpell(Head,SPELL_HEAD_INVIS,false);
m_creature->InterruptNonMeleeSpells(false);
DoCast(m_creature, SPELL_IMMUNE, true);
DoCast(m_creature, SPELL_BODY_REGEN, true);
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_IMMUNE, true);
DoCast(me, SPELL_BODY_REGEN, true);
DoCast(Head, SPELL_FLYING_HEAD, true);
DoCast(m_creature, SPELL_CONFUSE, false); //test
done_by->ProcDamageAndSpell(m_creature,PROC_FLAG_KILL,PROC_FLAG_KILLED,PROC_EX_NONE,0);
DoCast(me, SPELL_CONFUSE, false); //test
done_by->ProcDamageAndSpell(me,PROC_FLAG_KILL,PROC_FLAG_KILLED,PROC_EX_NONE,0);
whirlwind = urand(4000,8000);
regen = 0;
}
@@ -619,7 +619,7 @@ struct boss_headless_horsemanAI : public ScriptedAI
}
else
{
DoCast(m_creature, SPELL_RHYME_BIG);
DoCast(me, SPELL_RHYME_BIG);
if (plr)
{
plr->Say(Text[count].text,0);
@@ -638,8 +638,8 @@ struct boss_headless_horsemanAI : public ScriptedAI
if (wp_reached)
{
wp_reached = false;
m_creature->GetMotionMaster()->Clear(false);
m_creature->GetMotionMaster()->MovePoint(id,FlightPoint[id].x,FlightPoint[id].y,FlightPoint[id].z);
me->GetMotionMaster()->Clear(false);
me->GetMotionMaster()->MovePoint(id,FlightPoint[id].x,FlightPoint[id].y,FlightPoint[id].z);
}
}
}
@@ -649,7 +649,7 @@ struct boss_headless_horsemanAI : public ScriptedAI
break;
if (burn <= diff)
{
if (Creature *flame = m_creature->SummonCreature(HELPER,Spawn[0].x,Spawn[0].y,Spawn[0].z,0,TEMPSUMMON_TIMED_DESPAWN,17000))
if (Creature *flame = me->SummonCreature(HELPER,Spawn[0].x,Spawn[0].y,Spawn[0].z,0,TEMPSUMMON_TIMED_DESPAWN,17000))
CAST_AI(mob_wisp_invisAI, flame->AI())->SetType(2);
burned = true;
} else burn -= diff;
@@ -665,8 +665,8 @@ struct boss_headless_horsemanAI : public ScriptedAI
case 3:
if (summonadds <= diff)
{
m_creature->InterruptNonMeleeSpells(false);
DoCast(m_creature, SPELL_SUMMON_PUMPKIN);
me->InterruptNonMeleeSpells(false);
DoCast(me, SPELL_SUMMON_PUMPKIN);
SaySound(SAY_SPROUTING_PUMPKINS);
summonadds = urand(25000,35000);
} else summonadds -= diff;
@@ -676,8 +676,8 @@ struct boss_headless_horsemanAI : public ScriptedAI
if (laugh <= diff)
{
laugh = urand(11000,22000);
m_creature->MonsterTextEmote(EMOTE_LAUGHS,NULL);
DoPlaySoundToSet(m_creature, RandomLaugh[rand()%3]);
me->MonsterTextEmote(EMOTE_LAUGHS,NULL);
DoPlaySoundToSet(me, RandomLaugh[rand()%3]);
} else laugh -= diff;
if (UpdateVictim())
@@ -685,7 +685,7 @@ struct boss_headless_horsemanAI : public ScriptedAI
DoMeleeAttackIfReady();
if (cleave <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
cleave = urand(2000,6000); //1 cleave per 2.0-6.0sec
} else cleave -= diff;
}
@@ -695,13 +695,13 @@ struct boss_headless_horsemanAI : public ScriptedAI
if (regen <= diff)
{
regen = 1000; //"body calls head"
if (m_creature->GetHealth()/m_creature->GetMaxHealth() == 1 && !returned)
if (me->GetHealth()/me->GetMaxHealth() == 1 && !returned)
{
if (Phase > 1)
--Phase;
else
Phase = 1;
Creature* Head = Unit::GetCreature((*m_creature), headGUID);
Creature* Head = Unit::GetCreature((*me), headGUID);
if (Head && Head->isAlive())
{
CAST_AI(mob_headAI, Head->AI())->Phase = Phase;
@@ -717,11 +717,11 @@ struct boss_headless_horsemanAI : public ScriptedAI
whirlwind = urand(4000,8000);
if (urand(0,1))
{
m_creature->RemoveAurasDueToSpell(SPELL_CONFUSE);
DoCast(m_creature, SPELL_WHIRLWIND, true);
DoCast(m_creature, SPELL_CONFUSE);
me->RemoveAurasDueToSpell(SPELL_CONFUSE);
DoCast(me, SPELL_WHIRLWIND, true);
DoCast(me, SPELL_CONFUSE);
} else
m_creature->RemoveAurasDueToSpell(SPELL_WHIRLWIND);
me->RemoveAurasDueToSpell(SPELL_WHIRLWIND);
} else whirlwind -= diff;
}
}
@@ -733,17 +733,17 @@ void mob_headAI::Disappear()
return;
if (bodyGUID)
{
Creature *body = Unit::GetCreature((*m_creature), bodyGUID);
Creature *body = Unit::GetCreature((*me), bodyGUID);
if (body && body->isAlive())
{
withbody = true;
m_creature->RemoveAllAuras();
me->RemoveAllAuras();
body->RemoveAurasDueToSpell(SPELL_IMMUNE);//hack, SpellHit doesn't calls if body has immune aura
DoCast(body, SPELL_FLYING_HEAD);
m_creature->SetHealth(m_creature->GetMaxHealth());
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
m_creature->GetMotionMaster()->MoveIdle();
me->SetHealth(me->GetMaxHealth());
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->GetMotionMaster()->MoveIdle();
CAST_AI(boss_headless_horsemanAI, body->AI())->returned = true;
}
}
@@ -759,21 +759,21 @@ struct mob_pulsing_pumpkinAI : public ScriptedAI
void Reset()
{
float x, y, z;
m_creature->GetPosition(x, y, z); //this visual aura some under ground
m_creature->GetMap()->CreatureRelocation(m_creature, x,y,z + 0.35f, 0.0f);
me->GetPosition(x, y, z); //this visual aura some under ground
me->GetMap()->CreatureRelocation(me, x,y,z + 0.35f, 0.0f);
Despawn();
Creature *debuff = DoSpawnCreature(HELPER,0,0,0,0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,14500);
if (debuff)
{
debuff->SetDisplayId(m_creature->GetDisplayId());
debuff->SetDisplayId(me->GetDisplayId());
debuff->CastSpell(debuff,SPELL_PUMPKIN_AURA_GREEN,false);
CAST_AI(mob_wisp_invisAI, debuff->AI())->SetType(1);
debuffGUID = debuff->GetGUID();
}
sprouted = false;
DoCast(m_creature, SPELL_PUMPKIN_AURA, true);
DoCast(m_creature, SPELL_SPROUTING);
m_creature->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED);
DoCast(me, SPELL_PUMPKIN_AURA, true);
DoCast(me, SPELL_SPROUTING);
me->SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED);
}
void EnterCombat(Unit *who){}
@@ -783,18 +783,18 @@ struct mob_pulsing_pumpkinAI : public ScriptedAI
if (spell->Id == SPELL_SPROUTING)
{
sprouted = true;
m_creature->RemoveAllAuras();
m_creature->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED);
DoCast(m_creature, SPELL_SPROUT_BODY, true);
m_creature->UpdateEntry(PUMPKIN_FIEND);
DoStartMovement(m_creature->getVictim());
me->RemoveAllAuras();
me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_STUNNED);
DoCast(me, SPELL_SPROUT_BODY, true);
me->UpdateEntry(PUMPKIN_FIEND);
DoStartMovement(me->getVictim());
}
}
void Despawn()
{
if (!debuffGUID) return;
Unit *debuff = Unit::GetUnit((*m_creature),debuffGUID);
Unit *debuff = Unit::GetUnit((*me),debuffGUID);
if (debuff)
debuff->SetVisibility(VISIBILITY_OFF);
debuffGUID = 0;
@@ -804,10 +804,10 @@ struct mob_pulsing_pumpkinAI : public ScriptedAI
void MoveInLineOfSight(Unit *who)
{
if (!who || !who->isTargetableForAttack() || !m_creature->IsHostileTo(who) || m_creature->getVictim())
if (!who || !who->isTargetableForAttack() || !me->IsHostileTo(who) || me->getVictim())
return;
m_creature->AddThreat(who,0.0f);
me->AddThreat(who,0.0f);
if (sprouted)
DoStartMovement(who);
}
@@ -56,19 +56,19 @@ struct boss_herodAI : public ScriptedAI
void EnterCombat(Unit *who)
{
DoScriptText(SAY_AGGRO, m_creature);
DoCast(m_creature, SPELL_RUSHINGCHARGE);
DoScriptText(SAY_AGGRO, me);
DoCast(me, SPELL_RUSHINGCHARGE);
}
void KilledUnit(Unit *victim)
{
DoScriptText(SAY_KILL, m_creature);
DoScriptText(SAY_KILL, me);
}
void JustDied(Unit* killer)
{
for (uint8 i = 0; i < 20; ++i)
m_creature->SummonCreature(ENTRY_SCARLET_TRAINEE, 1939.18, -431.58, 17.09, 6.22, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
me->SummonCreature(ENTRY_SCARLET_TRAINEE, 1939.18, -431.58, 17.09, 6.22, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000);
}
void UpdateAI(const uint32 diff)
@@ -77,26 +77,26 @@ struct boss_herodAI : public ScriptedAI
return;
//If we are <30% hp goes Enraged
if (!Enrage && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 30 && !m_creature->IsNonMeleeSpellCasted(false))
if (!Enrage && me->GetHealth()*100 / me->GetMaxHealth() <= 30 && !me->IsNonMeleeSpellCasted(false))
{
DoScriptText(EMOTE_ENRAGE, m_creature);
DoScriptText(SAY_ENRAGE, m_creature);
DoCast(m_creature, SPELL_FRENZY);
DoScriptText(EMOTE_ENRAGE, me);
DoScriptText(SAY_ENRAGE, me);
DoCast(me, SPELL_FRENZY);
Enrage = true;
}
//Cleave_Timer
if (Cleave_Timer <= diff)
{
DoCast(m_creature->getVictim(), SPELL_CLEAVE);
DoCast(me->getVictim(), SPELL_CLEAVE);
Cleave_Timer = 12000;
} else Cleave_Timer -= diff;
// Whirlwind_Timer
if (Whirlwind_Timer <= diff)
{
DoScriptText(SAY_WHIRLWIND, m_creature);
DoCast(m_creature->getVictim(), SPELL_WHIRLWIND);
DoScriptText(SAY_WHIRLWIND, me);
DoCast(me->getVictim(), SPELL_WHIRLWIND);
Whirlwind_Timer = 30000;
} else Whirlwind_Timer -= diff;

Some files were not shown because too many files have changed in this diff Show More