Files
TCPlayerbotCore/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h
T

82 lines
3.2 KiB
C++
Raw Normal View History

2013-11-10 03:31:20 -03:30
/*
2016-01-01 00:34:25 +01:00
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
2013-11-10 03:31:20 -03:30
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2009-10-17 15:51:44 -07:00
2009-08-16 18:34:45 +02:00
#ifndef SC_FOLLOWERAI_H
#define SC_FOLLOWERAI_H
2009-10-17 15:51:44 -07:00
2010-01-19 11:36:05 +01:00
#include "ScriptSystem.h"
2009-10-17 15:51:44 -07:00
2009-08-20 18:50:41 +02:00
enum eFollowState
{
STATE_FOLLOW_NONE = 0x000,
STATE_FOLLOW_INPROGRESS = 0x001, //must always have this state for any follow
STATE_FOLLOW_RETURNING = 0x002, //when returning to combat start after being in combat
STATE_FOLLOW_PAUSED = 0x004, //disables following
STATE_FOLLOW_COMPLETE = 0x008, //follow is completed and may end
STATE_FOLLOW_PREEVENT = 0x010, //not implemented (allow pre event to run, before follow is initiated)
STATE_FOLLOW_POSTEVENT = 0x020 //can be set at complete and allow post event to run
};
2009-10-17 15:51:44 -07:00
class TC_GAME_API FollowerAI : public ScriptedAI
2009-08-16 18:34:45 +02:00
{
public:
2011-08-20 20:31:31 -03:00
explicit FollowerAI(Creature* creature);
~FollowerAI() { }
2009-10-17 15:51:44 -07:00
2009-08-16 18:34:45 +02:00
//virtual void WaypointReached(uint32 uiPointId) = 0;
2009-10-17 15:51:44 -07:00
2014-08-09 20:17:40 +01:00
void MovementInform(uint32 motionType, uint32 pointId) override;
2009-10-17 15:51:44 -07:00
2014-08-09 20:17:40 +01:00
void AttackStart(Unit*) override;
2009-10-17 15:51:44 -07:00
2014-08-09 20:17:40 +01:00
void MoveInLineOfSight(Unit*) override;
2009-10-17 15:51:44 -07:00
void EnterEvadeMode(EvadeReason /*why*/ = EVADE_REASON_OTHER) override;
2009-10-17 15:51:44 -07:00
2014-08-09 20:17:40 +01:00
void JustDied(Unit*) override;
2009-10-17 15:51:44 -07:00
2014-08-09 20:17:40 +01:00
void JustRespawned() override;
2009-10-17 15:51:44 -07:00
2014-08-09 20:17:40 +01:00
void UpdateAI(uint32) override; //the "internal" update, calls UpdateFollowerAI()
virtual void UpdateFollowerAI(uint32); //used when it's needed to add code in update (abilities, scripted events, etc)
2009-10-17 15:51:44 -07:00
2011-08-20 20:31:31 -03:00
void StartFollow(Player* player, uint32 factionForFollower = 0, const Quest* quest = NULL);
2009-10-17 15:51:44 -07:00
2009-08-20 18:50:41 +02:00
void SetFollowPaused(bool bPaused); //if special event require follow mode to hold/resume during the follow
2009-10-11 18:03:59 +02:00
void SetFollowComplete(bool bWithEndEvent = false);
2009-10-17 15:51:44 -07:00
2014-07-17 15:42:57 +02:00
bool HasFollowState(uint32 uiFollowState) { return (m_uiFollowState & uiFollowState) != 0; }
2009-10-17 15:51:44 -07:00
2009-08-20 22:37:19 +02:00
protected:
2009-08-16 18:34:45 +02:00
Player* GetLeaderForFollower();
2009-10-17 15:51:44 -07:00
2009-08-16 18:34:45 +02:00
private:
2009-08-20 22:37:19 +02:00
void AddFollowState(uint32 uiFollowState) { m_uiFollowState |= uiFollowState; }
void RemoveFollowState(uint32 uiFollowState) { m_uiFollowState &= ~uiFollowState; }
2009-10-17 15:51:44 -07:00
2011-08-20 20:31:31 -03:00
bool AssistPlayerInCombat(Unit* who);
2009-10-17 15:51:44 -07:00
ObjectGuid m_uiLeaderGUID;
2009-08-16 18:34:45 +02:00
uint32 m_uiUpdateFollowTimer;
2009-08-20 18:50:41 +02:00
uint32 m_uiFollowState;
2009-10-17 15:51:44 -07:00
2009-08-16 18:34:45 +02:00
const Quest* m_pQuestForFollow; //normally we have a quest
};
2009-10-17 15:51:44 -07:00
2009-08-16 18:34:45 +02:00
#endif