Scripts/Azuremyst Isle: Fix The Prophecy of Akida.
- Issues with gameobject resetting resolved. - Will now move more blizz-like. There are more cage release quests smiliar to this witch could probably be generalized.
This commit is contained in:
@@ -660,70 +660,103 @@ enum BristlelimbCage
|
|||||||
QUEST_THE_PROPHECY_OF_AKIDA = 9544,
|
QUEST_THE_PROPHECY_OF_AKIDA = 9544,
|
||||||
NPC_STILLPINE_CAPITIVE = 17375,
|
NPC_STILLPINE_CAPITIVE = 17375,
|
||||||
GO_BRISTELIMB_CAGE = 181714,
|
GO_BRISTELIMB_CAGE = 181714,
|
||||||
|
|
||||||
CAPITIVE_SAY_1 = -1000474,
|
CAPITIVE_SAY_1 = -1000474,
|
||||||
CAPITIVE_SAY_2 = -1000475,
|
CAPITIVE_SAY_2 = -1000475,
|
||||||
CAPITIVE_SAY_3 = -1000476
|
CAPITIVE_SAY_3 = -1000476,
|
||||||
|
|
||||||
|
POINT_INIT = 1,
|
||||||
|
EVENT_DESPAWN = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
class npc_stillpine_capitive : public CreatureScript
|
class npc_stillpine_capitive : public CreatureScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
npc_stillpine_capitive() : CreatureScript("npc_stillpine_capitive") { }
|
npc_stillpine_capitive() : CreatureScript("npc_stillpine_capitive") { }
|
||||||
|
|
||||||
struct npc_stillpine_capitiveAI : public ScriptedAI
|
struct npc_stillpine_capitiveAI : public ScriptedAI
|
||||||
{
|
|
||||||
npc_stillpine_capitiveAI(Creature *c) : ScriptedAI(c){}
|
|
||||||
|
|
||||||
uint32 FleeTimer;
|
|
||||||
|
|
||||||
void Reset()
|
|
||||||
{
|
{
|
||||||
FleeTimer = 0;
|
npc_stillpine_capitiveAI(Creature* creature) : ScriptedAI(creature)
|
||||||
GameObject* cage = me->FindNearestGameObject(GO_BRISTELIMB_CAGE, 5.0f);
|
|
||||||
if(cage)
|
|
||||||
cage->ResetDoorOrButton();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateAI(const uint32 diff)
|
|
||||||
{
|
|
||||||
if(FleeTimer)
|
|
||||||
{
|
{
|
||||||
if(FleeTimer <= diff)
|
if (GameObject* cage = me->FindNearestGameObject(GO_BRISTELIMB_CAGE, 5.0f))
|
||||||
me->DespawnOrUnsummon();
|
cage->UseDoorOrButton(); // This may seem strange but is actually closing door.
|
||||||
else FleeTimer -= diff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Reset()
|
||||||
|
{
|
||||||
|
_events.Reset();
|
||||||
|
_player = NULL;
|
||||||
|
_movementComplete = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StartMoving(Player* owner)
|
||||||
|
{
|
||||||
|
if (owner)
|
||||||
|
{
|
||||||
|
DoScriptText(RAND(CAPITIVE_SAY_1, CAPITIVE_SAY_2, CAPITIVE_SAY_3), me, owner);
|
||||||
|
_player = owner;
|
||||||
|
}
|
||||||
|
Position pos;
|
||||||
|
me->GetNearPosition(pos, 3.5f, 0.0f);
|
||||||
|
me->GetMotionMaster()->MovePoint(POINT_INIT, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MovementInform(uint32 type, uint32 id)
|
||||||
|
{
|
||||||
|
if (type != POINT_MOTION_TYPE || id != POINT_INIT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_player)
|
||||||
|
_player->KilledMonsterCredit(me->GetEntry(), me->GetGUID());
|
||||||
|
|
||||||
|
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
|
||||||
|
me->GetMotionMaster()->MovementExpired();
|
||||||
|
|
||||||
|
_movementComplete = true;
|
||||||
|
_events.ScheduleEvent(EVENT_DESPAWN, 3500);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateAI(uint32 const diff)
|
||||||
|
{
|
||||||
|
if (!_movementComplete)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_events.Update(diff);
|
||||||
|
|
||||||
|
if (_events.ExecuteEvent() == EVENT_DESPAWN)
|
||||||
|
me->DespawnOrUnsummon();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Player* _player;
|
||||||
|
EventMap _events;
|
||||||
|
bool _movementComplete;
|
||||||
|
};
|
||||||
|
|
||||||
|
CreatureAI* GetAI(Creature* creature) const
|
||||||
|
{
|
||||||
|
return new npc_stillpine_capitiveAI(creature);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* pCreature) const
|
|
||||||
{
|
|
||||||
return new npc_stillpine_capitiveAI(pCreature);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class go_bristlelimb_cage : public GameObjectScript
|
class go_bristlelimb_cage : public GameObjectScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
go_bristlelimb_cage() : GameObjectScript("go_bristlelimb_cage") { }
|
go_bristlelimb_cage() : GameObjectScript("go_bristlelimb_cage") { }
|
||||||
|
|
||||||
bool OnGossipHello(Player* pPlayer, GameObject* pGo)
|
bool OnGossipHello(Player* player, GameObject* go)
|
||||||
{
|
|
||||||
if(pPlayer->GetQuestStatus(QUEST_THE_PROPHECY_OF_AKIDA) == QUEST_STATUS_INCOMPLETE)
|
|
||||||
{
|
{
|
||||||
Creature* pCreature = pGo->FindNearestCreature(NPC_STILLPINE_CAPITIVE, 5.0f, true);
|
if (player->GetQuestStatus(QUEST_THE_PROPHECY_OF_AKIDA) == QUEST_STATUS_INCOMPLETE)
|
||||||
if(pCreature)
|
|
||||||
{
|
{
|
||||||
DoScriptText(RAND(CAPITIVE_SAY_1, CAPITIVE_SAY_2, CAPITIVE_SAY_3), pCreature, pPlayer);
|
if (Creature* capitive = go->FindNearestCreature(NPC_STILLPINE_CAPITIVE, 5.0f, true))
|
||||||
pCreature->GetMotionMaster()->MoveFleeing(pPlayer, 3500);
|
{
|
||||||
pPlayer->KilledMonsterCredit(pCreature->GetEntry(), pCreature->GetGUID());
|
go->ResetDoorOrButton();
|
||||||
CAST_AI(npc_stillpine_capitive::npc_stillpine_capitiveAI, pCreature->AI())->FleeTimer = 3500;
|
CAST_AI(npc_stillpine_capitive::npc_stillpine_capitiveAI, capitive->AI())->StartMoving(player);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_azuremyst_isle()
|
void AddSC_azuremyst_isle()
|
||||||
|
|||||||
Reference in New Issue
Block a user