diff options
author | megamage <none@none> | 2009-08-11 21:40:18 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-08-11 21:40:18 -0500 |
commit | 1ff5e51ddcd9110596791802ace878aab14b46be (patch) | |
tree | c995ea31d043a3880882aaf33afb1a446737380d /src | |
parent | 08121cc271d6eee0d087825976e20ef869585259 (diff) |
*Fix the bug that npc in quest endless hunger assist each other.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp b/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp index ad7fae65a67..fa3dd6fa0ff 100644 --- a/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp +++ b/src/bindings/scripts/scripts/zone/eastern_plaguelands/the_scarlet_enclave.cpp @@ -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; |