*Cleanup of unworthy initiate script.
--HG-- branch : trunk
This commit is contained in:
@@ -537,13 +537,13 @@ uint32 acherus_unworthy_initiate[5] =
|
|||||||
29567
|
29567
|
||||||
};
|
};
|
||||||
|
|
||||||
enum initiate_phase
|
enum UnworthyInitiatePhase
|
||||||
{
|
{
|
||||||
Chained,
|
PHASE_CHAINED,
|
||||||
ToEquipping,
|
PHASE_TO_EQUIP,
|
||||||
Equipping,
|
PHASE_EQUIPING,
|
||||||
ToAttacking,
|
PHASE_TO_ATTACK,
|
||||||
Attacking
|
PHASE_ATTACKING,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI
|
struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI
|
||||||
@@ -559,7 +559,7 @@ struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI
|
|||||||
|
|
||||||
bool event_startet;
|
bool event_startet;
|
||||||
uint64 event_starter;
|
uint64 event_starter;
|
||||||
initiate_phase phase;
|
UnworthyInitiatePhase phase;
|
||||||
uint32 wait_timer;
|
uint32 wait_timer;
|
||||||
float targ_x,targ_y,targ_z;
|
float targ_x,targ_y,targ_z;
|
||||||
uint64 anchorGUID;
|
uint64 anchorGUID;
|
||||||
@@ -569,7 +569,7 @@ struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI
|
|||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
anchorGUID = 0;
|
anchorGUID = 0;
|
||||||
phase = Chained;
|
phase = PHASE_CHAINED;
|
||||||
events.Reset();
|
events.Reset();
|
||||||
m_creature->setFaction(7);
|
m_creature->setFaction(7);
|
||||||
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2);
|
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2);
|
||||||
@@ -606,14 +606,14 @@ struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI
|
|||||||
if(Unit* starter = Unit::GetUnit((*m_creature),event_starter))
|
if(Unit* starter = Unit::GetUnit((*m_creature),event_starter))
|
||||||
DoScriptText(say_event_attack[rand()%9],m_creature,starter);
|
DoScriptText(say_event_attack[rand()%9],m_creature,starter);
|
||||||
|
|
||||||
phase = ToAttacking;
|
phase = PHASE_TO_ATTACK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventStart(Creature* anchor, Player* target)
|
void EventStart(Creature* anchor, Player* target)
|
||||||
{
|
{
|
||||||
wait_timer = 5000;
|
wait_timer = 5000;
|
||||||
phase = ToEquipping;
|
phase = PHASE_TO_EQUIP;
|
||||||
|
|
||||||
m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
||||||
m_creature->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN_SELF);
|
m_creature->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN_SELF);
|
||||||
@@ -634,34 +634,26 @@ CreatureAI* GetAI_npc_unworthy_initiate(Creature *_Creature)
|
|||||||
return new npc_unworthy_initiateAI(_Creature);
|
return new npc_unworthy_initiateAI(_Creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TRINITY_DLL_DECL npc_unworthy_initiate_anchorAI : public ScriptedAI
|
struct TRINITY_DLL_DECL npc_unworthy_initiate_anchorAI : public PassiveAI
|
||||||
{
|
{
|
||||||
npc_unworthy_initiate_anchorAI(Creature *c) : ScriptedAI(c) { guid_target = 0; }
|
npc_unworthy_initiate_anchorAI(Creature *c) : PassiveAI(c), prisonerGUID(0) {}
|
||||||
|
|
||||||
uint64 guid_target;
|
uint64 prisonerGUID;
|
||||||
|
|
||||||
void Reset(){}
|
void SetGUID(const uint64 &guid, int32 id)
|
||||||
|
|
||||||
void SetTarget(uint64 target);
|
|
||||||
uint64 GetTarget()
|
|
||||||
{
|
{
|
||||||
return guid_target;
|
if(!prisonerGUID)
|
||||||
|
prisonerGUID = guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAI(const uint32 diff){}
|
uint64 GetGUID(int32 id) { return prisonerGUID; }
|
||||||
};
|
};
|
||||||
|
|
||||||
void npc_unworthy_initiate_anchorAI::SetTarget(uint64 target)
|
|
||||||
{
|
|
||||||
if(guid_target <= 0)
|
|
||||||
guid_target = target;
|
|
||||||
}
|
|
||||||
|
|
||||||
void npc_unworthy_initiateAI::UpdateAI(const uint32 diff)
|
void npc_unworthy_initiateAI::UpdateAI(const uint32 diff)
|
||||||
{
|
{
|
||||||
switch(phase)
|
switch(phase)
|
||||||
{
|
{
|
||||||
case Chained:
|
case PHASE_CHAINED:
|
||||||
if(!anchorGUID)
|
if(!anchorGUID)
|
||||||
{
|
{
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
@@ -687,31 +679,31 @@ void npc_unworthy_initiateAI::UpdateAI(const uint32 diff)
|
|||||||
if(Creature* trigger = me->FindNearestCreature(29521, 30))
|
if(Creature* trigger = me->FindNearestCreature(29521, 30))
|
||||||
{
|
{
|
||||||
prison->ResetDoorOrButton();
|
prison->ResetDoorOrButton();
|
||||||
CAST_AI(npc_unworthy_initiate_anchorAI, trigger->AI())->SetTarget(m_creature->GetGUID());
|
trigger->AI()->SetGUID(m_creature->GetGUID());
|
||||||
trigger->CastSpell(me, SPELL_SOUL_PRISON_CHAIN, true);
|
trigger->CastSpell(me, SPELL_SOUL_PRISON_CHAIN, true);
|
||||||
anchorGUID = trigger->GetGUID();
|
anchorGUID = trigger->GetGUID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case ToEquipping:
|
case PHASE_TO_EQUIP:
|
||||||
if(wait_timer)
|
if(wait_timer)
|
||||||
{
|
{
|
||||||
if(wait_timer < diff)
|
if(wait_timer < diff)
|
||||||
{
|
{
|
||||||
m_creature->GetMotionMaster()->MovePoint(1,targ_x,targ_y,m_creature->GetPositionZ());
|
m_creature->GetMotionMaster()->MovePoint(1,targ_x,targ_y,m_creature->GetPositionZ());
|
||||||
phase = Equipping;
|
phase = PHASE_EQUIPING;
|
||||||
wait_timer = 0;
|
wait_timer = 0;
|
||||||
}else wait_timer -= diff;
|
}else wait_timer -= diff;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case ToAttacking:
|
case PHASE_TO_ATTACK:
|
||||||
if(wait_timer)
|
if(wait_timer)
|
||||||
{
|
{
|
||||||
if(wait_timer < diff)
|
if(wait_timer < diff)
|
||||||
{
|
{
|
||||||
m_creature->setFaction(14);
|
m_creature->setFaction(14);
|
||||||
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2);
|
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2);
|
||||||
phase = Attacking;
|
phase = PHASE_ATTACKING;
|
||||||
|
|
||||||
if(Unit* target = Unit::GetUnit((*m_creature),event_starter))
|
if(Unit* target = Unit::GetUnit((*m_creature),event_starter))
|
||||||
m_creature->AI()->AttackStart(target);
|
m_creature->AI()->AttackStart(target);
|
||||||
@@ -719,7 +711,7 @@ void npc_unworthy_initiateAI::UpdateAI(const uint32 diff)
|
|||||||
}else wait_timer -= diff;
|
}else wait_timer -= diff;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case Attacking:
|
case PHASE_ATTACKING:
|
||||||
if(!UpdateVictim())
|
if(!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -762,21 +754,12 @@ CreatureAI* GetAI_npc_unworthy_initiate_anchor(Creature *_Creature)
|
|||||||
return new npc_unworthy_initiate_anchorAI(_Creature);
|
return new npc_unworthy_initiate_anchorAI(_Creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GOHello_go_acherus_soul_prison(Player *player, GameObject* _GO)
|
bool GOHello_go_acherus_soul_prison(Player *player, GameObject* go)
|
||||||
{
|
{
|
||||||
Creature* finder = player->SummonCreature(WORLD_TRIGGER,_GO->GetPositionX(),_GO->GetPositionY(),_GO->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,2000);
|
if(Creature *anchor = go->FindNearestCreature(29521, 15))
|
||||||
if(!finder) return false;
|
if(uint64 prisonerGUID = anchor->AI()->GetGUID())
|
||||||
|
if(Creature* prisoner = Creature::GetCreature(*player, prisonerGUID))
|
||||||
Unit* prison_anchor = finder->FindNearestCreature(29521, 15);
|
CAST_AI(npc_unworthy_initiateAI, (prisoner->AI()))->EventStart(anchor, player);
|
||||||
if(!prison_anchor) return false;
|
|
||||||
|
|
||||||
uint64 owner = CAST_AI(npc_unworthy_initiate_anchorAI, CAST_CRE(prison_anchor)->AI())->GetTarget();
|
|
||||||
|
|
||||||
Creature* prisoner = Creature::GetCreature((*player),owner);
|
|
||||||
if(prisoner)
|
|
||||||
{
|
|
||||||
CAST_AI(npc_unworthy_initiateAI, (prisoner->AI()))->EventStart(CAST_CRE(prison_anchor),player);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -57,7 +57,8 @@ class TRINITY_DLL_SPEC UnitAI
|
|||||||
|
|
||||||
// Pass parameters between AI
|
// Pass parameters between AI
|
||||||
virtual void DoAction(const int32 param = 0) {}
|
virtual void DoAction(const int32 param = 0) {}
|
||||||
virtual void SetGUID(const uint64 &guid, const int32 param = 0) {}
|
virtual void SetGUID(const uint64 &guid, int32 id = 0) {}
|
||||||
|
virtual uint64 GetGUID(int32 id = 0) { return 0; }
|
||||||
|
|
||||||
Unit* SelectTarget(SelectAggroTarget target, uint32 position = 0, float dist = 0, bool playerOnly = false, int32 aura = 0);
|
Unit* SelectTarget(SelectAggroTarget target, uint32 position = 0, float dist = 0, bool playerOnly = false, int32 aura = 0);
|
||||||
void SelectTargetList(std::list<Unit*> &targetList, uint32 num, SelectAggroTarget target, float dist = 0, bool playerOnly = false, int32 aura = 0);
|
void SelectTargetList(std::list<Unit*> &targetList, uint32 num, SelectAggroTarget target, float dist = 0, bool playerOnly = false, int32 aura = 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user