Core/Movement: merged smooth waypoints (commit: 05fb27dae4)

This commit is contained in:
Ovalord
2018-02-15 13:28:36 +01:00
parent 9b8b296b8a
commit 6dddfc812c
16 changed files with 618 additions and 642 deletions

View File

@@ -18,6 +18,7 @@
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "SpellScript.h"
#include "PassiveAI.h"
#include "GameObjectAI.h"
@@ -869,11 +870,15 @@ class npc_brann_bronzebeard_algalon : public CreatureScript
public:
npc_brann_bronzebeard_algalon() : CreatureScript("npc_brann_bronzebeard_algalon") { }
struct npc_brann_bronzebeard_algalonAI : public CreatureAI
struct npc_brann_bronzebeard_algalonAI : public npc_escortAI
{
npc_brann_bronzebeard_algalonAI(Creature* creature) : CreatureAI(creature)
npc_brann_bronzebeard_algalonAI(Creature* creature) : npc_escortAI(creature)
{
_currentPoint = 0;
SetDespawnAtEnd(false);
SetDespawnAtFar(false);
for (uint8 i = 0; i < MAX_BRANN_WAYPOINTS_INTRO; ++i)
AddWaypoint(i, BrannIntroWaypoint[i].GetPositionX(), BrannIntroWaypoint[i].GetPositionY(), BrannIntroWaypoint[i].GetPositionZ());
}
void DoAction(int32 action) override
@@ -881,14 +886,12 @@ class npc_brann_bronzebeard_algalon : public CreatureScript
switch (action)
{
case ACTION_START_INTRO:
_currentPoint = 0;
_events.Reset();
me->SetWalk(false);
_events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 1);
Start(false, true);
break;
case ACTION_FINISH_INTRO:
Talk(SAY_BRANN_ALGALON_INTRO_2);
_events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 1);
SetEscortPaused(false);
break;
case ACTION_OUTRO:
me->GetMotionMaster()->MovePoint(POINT_BRANN_OUTRO, BrannOutroPos[1]);
@@ -898,37 +901,27 @@ class npc_brann_bronzebeard_algalon : public CreatureScript
}
}
void MovementInform(uint32 movementType, uint32 pointId) override
void WaypointReached(uint32 pointId) override
{
if (movementType != POINT_MOTION_TYPE)
return;
uint32 delay = 1;
_currentPoint = pointId + 1;
switch (pointId)
{
case 2:
delay = 8000;
me->SetWalk(true); break;
SetEscortPaused(true);
_events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, 8000);
SetRun(false);
break;
case 5:
me->SetWalk(false);
SetRun(true);
SetEscortPaused(true);
Talk(SAY_BRANN_ALGALON_INTRO_1);
_events.ScheduleEvent(EVENT_SUMMON_ALGALON, 7500);
return;
case 9:
me->DespawnOrUnsummon(1);
return;
case POINT_BRANN_OUTRO:
case POINT_BRANN_OUTRO_END:
return;
break;
}
_events.ScheduleEvent(EVENT_BRANN_MOVE_INTRO, delay);
}
void UpdateAI(uint32 diff) override
{
UpdateVictim();
npc_escortAI::UpdateAI(diff);
if (_events.Empty())
return;
@@ -940,8 +933,7 @@ class npc_brann_bronzebeard_algalon : public CreatureScript
switch (eventId)
{
case EVENT_BRANN_MOVE_INTRO:
if (_currentPoint < MAX_BRANN_WAYPOINTS_INTRO)
me->GetMotionMaster()->MovePoint(_currentPoint, BrannIntroWaypoint[_currentPoint]);
SetEscortPaused(false);
break;
case EVENT_SUMMON_ALGALON:
if (Creature* algalon = me->GetMap()->SummonCreature(NPC_ALGALON, AlgalonSummonPos))
@@ -959,7 +951,6 @@ class npc_brann_bronzebeard_algalon : public CreatureScript
private:
EventMap _events;
uint32 _currentPoint;
};
CreatureAI* GetAI(Creature* creature) const override