*code cleanup
*totally destroyed m_creature, use "me" for future coding --HG-- branch : trunk
This commit is contained in:
1 parent
cc262e1cde
commit
6bcb297de4
403 files changed
+9851
-9852
No files matched your search
+141
-141
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user