2018-08-29 21:40:59 +02:00
|
|
|
#ifndef _BNPC_H_
|
|
|
|
#define _BNPC_H_
|
|
|
|
|
|
|
|
#include <Common.h>
|
|
|
|
|
|
|
|
#include "Forwards.h"
|
|
|
|
#include "Chara.h"
|
2018-08-29 22:03:10 +02:00
|
|
|
#include "Npc.h"
|
2018-08-29 21:40:59 +02:00
|
|
|
#include <set>
|
|
|
|
#include <map>
|
|
|
|
#include <queue>
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
namespace Sapphire::Entity
|
2018-10-28 21:53:21 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2019-01-17 23:54:47 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint32_t m_hateAmount;
|
|
|
|
ActorPtr m_pActor;
|
|
|
|
} HateListEntry;
|
|
|
|
|
|
|
|
enum class BNpcState
|
|
|
|
{
|
|
|
|
Idle,
|
|
|
|
Combat,
|
|
|
|
Retreat,
|
|
|
|
JustDied,
|
|
|
|
Dead,
|
|
|
|
};
|
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
/*!
|
|
|
|
\class BNpc
|
|
|
|
\brief Base class for all BNpcs
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
*/
|
|
|
|
class BNpc : public Npc
|
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
public:
|
2018-12-29 00:53:52 +01:00
|
|
|
BNpc( FrameworkPtr pFw );
|
2019-01-13 00:51:31 +01:00
|
|
|
BNpc( uint32_t id, BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, float rot,
|
2019-01-17 23:54:47 +01:00
|
|
|
uint8_t level, uint32_t maxHp, ZonePtr pZone,FrameworkPtr pFw );
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
virtual ~BNpc() override;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
void spawn( PlayerPtr pTarget ) override;
|
2018-09-09 23:56:22 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
uint16_t getModelChara() const;
|
|
|
|
uint8_t getLevel() const override;
|
2018-09-13 22:14:31 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
uint32_t getBNpcBaseId() const;
|
|
|
|
uint32_t getBNpcNameId() const;
|
2018-09-13 22:14:31 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
uint8_t getEnemyType() const;
|
2018-09-13 22:14:31 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
uint64_t getWeaponMain() const;
|
|
|
|
uint64_t getWeaponSub() const;
|
2018-09-13 22:14:31 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
uint8_t getAggressionMode() const;
|
2018-09-13 22:14:31 +02:00
|
|
|
|
2019-01-17 23:54:47 +01:00
|
|
|
// return true if it reached the position
|
|
|
|
bool moveTo( const Common::FFXIVARR_POSITION3& pos );
|
|
|
|
|
|
|
|
void sendPositionUpdate();
|
|
|
|
|
|
|
|
BNpcState getState() const;
|
|
|
|
void setState( BNpcState state );
|
|
|
|
|
|
|
|
void hateListClear();
|
|
|
|
ActorPtr hateListGetHighest();
|
|
|
|
void hateListAdd( ActorPtr pActor, int32_t hateAmount );
|
|
|
|
void hateListUpdate( ActorPtr pActor, int32_t hateAmount );
|
|
|
|
void hateListRemove( ActorPtr pActor );
|
|
|
|
bool hateListHasActor( ActorPtr pActor );
|
|
|
|
|
|
|
|
void aggro( ActorPtr pActor );
|
|
|
|
void deaggro( ActorPtr pActor );
|
|
|
|
|
|
|
|
void update( int64_t currTime ) override;
|
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
private:
|
|
|
|
uint32_t m_bNpcBaseId;
|
|
|
|
uint32_t m_bNpcNameId;
|
|
|
|
uint64_t m_weaponMain;
|
|
|
|
uint64_t m_weaponSub;
|
|
|
|
uint8_t m_aggressionMode;
|
|
|
|
uint8_t m_enemyType;
|
|
|
|
uint8_t m_onlineStatus;
|
|
|
|
uint8_t m_pose;
|
|
|
|
uint16_t m_modelChara;
|
|
|
|
uint32_t m_displayFlags;
|
|
|
|
uint8_t m_level;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2019-01-17 23:54:47 +01:00
|
|
|
Common::FFXIVARR_POSITION3 m_spawnPos;
|
|
|
|
|
|
|
|
BNpcState m_state;
|
|
|
|
std::set< std::shared_ptr< HateListEntry > > m_hateList;
|
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
};
|
2018-08-29 21:40:59 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|