*Fix the bug that npc in quest endless hunger assist each other.
--HG-- branch : trunk
This commit is contained in:
@@ -550,6 +550,7 @@ struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI
|
|||||||
npc_unworthy_initiateAI(Creature *c) : ScriptedAI(c)
|
npc_unworthy_initiateAI(Creature *c) : ScriptedAI(c)
|
||||||
{
|
{
|
||||||
m_creature->GetHomePosition(home_x,home_y,home_z,home_ori);
|
m_creature->GetHomePosition(home_x,home_y,home_z,home_ori);
|
||||||
|
me->SetReactState(REACT_PASSIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
float home_x,home_y,home_z,home_ori;
|
float home_x,home_y,home_z,home_ori;
|
||||||
@@ -558,13 +559,13 @@ struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI
|
|||||||
initiate_phase phase;
|
initiate_phase phase;
|
||||||
uint32 wait_timer;
|
uint32 wait_timer;
|
||||||
float targ_x,targ_y,targ_z;
|
float targ_x,targ_y,targ_z;
|
||||||
uint64 anchor;
|
uint64 anchorGUID;
|
||||||
|
|
||||||
EventMap events;
|
EventMap events;
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
anchor = 0;
|
anchorGUID = 0;
|
||||||
phase = Chained;
|
phase = Chained;
|
||||||
events.Reset();
|
events.Reset();
|
||||||
m_creature->setFaction(7);
|
m_creature->setFaction(7);
|
||||||
@@ -663,39 +664,34 @@ void npc_unworthy_initiateAI::UpdateAI(const uint32 diff)
|
|||||||
switch(phase)
|
switch(phase)
|
||||||
{
|
{
|
||||||
case Chained:
|
case Chained:
|
||||||
if(anchor == 0)
|
if(!anchorGUID)
|
||||||
{
|
{
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
float dist = 99.0f;
|
float dist = 99.0f;
|
||||||
uint64 nearest_prison;
|
GameObject *prison = NULL;
|
||||||
|
|
||||||
for(uint8 i = 0; i < 12; i++)
|
for(uint8 i = 0; i < 12; ++i)
|
||||||
{
|
{
|
||||||
GameObject* temp_prison;
|
if(GameObject* temp_prison = m_creature->FindNearestGameObject(acherus_soul_prison[i],30))
|
||||||
temp_prison = m_creature->FindNearestGameObject(acherus_soul_prison[i],30);
|
|
||||||
if(temp_prison)
|
|
||||||
{
|
{
|
||||||
if(dist == 99.0f || m_creature->IsWithinDist(temp_prison, dist, false))
|
if(dist == 99.0f || m_creature->IsWithinDist(temp_prison, dist, false))
|
||||||
{
|
{
|
||||||
temp_prison->GetPosition(x, y, z);
|
temp_prison->GetPosition(x, y, z);
|
||||||
dist = m_creature->GetDistance2d(temp_prison);
|
dist = m_creature->GetDistance2d(temp_prison);
|
||||||
nearest_prison = temp_prison->GetGUID();
|
prison = temp_prison;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dist == 99)
|
if(!prison)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Creature* trigger = m_creature->FindNearestCreature(29521,30);
|
if(Creature* trigger = me->FindNearestCreature(29521, 30))
|
||||||
if(trigger)
|
|
||||||
{
|
{
|
||||||
if(GameObject* go_prison = GameObject::GetGameObject((*m_creature),nearest_prison))
|
prison->ResetDoorOrButton();
|
||||||
go_prison->ResetDoorOrButton();
|
|
||||||
|
|
||||||
CAST_AI(npc_unworthy_initiate_anchorAI, trigger->AI())->SetTarget(m_creature->GetGUID());
|
CAST_AI(npc_unworthy_initiate_anchorAI, trigger->AI())->SetTarget(m_creature->GetGUID());
|
||||||
trigger->CastSpell(m_creature,SPELL_SOUL_PRISON_CHAIN,true);
|
trigger->CastSpell(me, SPELL_SOUL_PRISON_CHAIN, true);
|
||||||
anchor = trigger->GetGUID();
|
anchorGUID = trigger->GetGUID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user