*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)
|
||||
{
|
||||
m_creature->GetHomePosition(home_x,home_y,home_z,home_ori);
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
|
||||
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;
|
||||
uint32 wait_timer;
|
||||
float targ_x,targ_y,targ_z;
|
||||
uint64 anchor;
|
||||
uint64 anchorGUID;
|
||||
|
||||
EventMap events;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
anchor = 0;
|
||||
anchorGUID = 0;
|
||||
phase = Chained;
|
||||
events.Reset();
|
||||
m_creature->setFaction(7);
|
||||
@@ -663,39 +664,34 @@ void npc_unworthy_initiateAI::UpdateAI(const uint32 diff)
|
||||
switch(phase)
|
||||
{
|
||||
case Chained:
|
||||
if(anchor == 0)
|
||||
if(!anchorGUID)
|
||||
{
|
||||
float x, y, z;
|
||||
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;
|
||||
temp_prison = m_creature->FindNearestGameObject(acherus_soul_prison[i],30);
|
||||
if(temp_prison)
|
||||
if(GameObject* temp_prison = m_creature->FindNearestGameObject(acherus_soul_prison[i],30))
|
||||
{
|
||||
if(dist == 99.0f || m_creature->IsWithinDist(temp_prison, dist, false))
|
||||
{
|
||||
temp_prison->GetPosition(x, y, z);
|
||||
dist = m_creature->GetDistance2d(temp_prison);
|
||||
nearest_prison = temp_prison->GetGUID();
|
||||
prison = temp_prison;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(dist == 99)
|
||||
if(!prison)
|
||||
return;
|
||||
|
||||
Creature* trigger = m_creature->FindNearestCreature(29521,30);
|
||||
if(trigger)
|
||||
if(Creature* trigger = me->FindNearestCreature(29521, 30))
|
||||
{
|
||||
if(GameObject* go_prison = GameObject::GetGameObject((*m_creature),nearest_prison))
|
||||
go_prison->ResetDoorOrButton();
|
||||
|
||||
prison->ResetDoorOrButton();
|
||||
CAST_AI(npc_unworthy_initiate_anchorAI, trigger->AI())->SetTarget(m_creature->GetGUID());
|
||||
trigger->CastSpell(m_creature,SPELL_SOUL_PRISON_CHAIN,true);
|
||||
anchor = trigger->GetGUID();
|
||||
trigger->CastSpell(me, SPELL_SOUL_PRISON_CHAIN, true);
|
||||
anchorGUID = trigger->GetGUID();
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user