2018-08-29 21:40:59 +02:00
|
|
|
#include <Util/Util.h>
|
|
|
|
#include <Util/UtilMath.h>
|
|
|
|
#include <Network/PacketContainer.h>
|
|
|
|
#include <Exd/ExdDataGenerated.h>
|
|
|
|
#include <utility>
|
|
|
|
#include <Network/CommonActorControl.h>
|
2018-09-20 23:31:38 +02:00
|
|
|
#include <Network/PacketWrappers/EffectPacket.h>
|
2018-08-29 21:40:59 +02:00
|
|
|
|
|
|
|
#include "Forwards.h"
|
|
|
|
#include "Action/Action.h"
|
|
|
|
|
|
|
|
#include "Zone/Zone.h"
|
|
|
|
|
|
|
|
#include "Network/GameConnection.h"
|
|
|
|
#include "Network/PacketWrappers/ActorControlPacket142.h"
|
|
|
|
#include "Network/PacketWrappers/ActorControlPacket143.h"
|
|
|
|
#include "Network/PacketWrappers/ActorControlPacket144.h"
|
|
|
|
#include "Network/PacketWrappers/UpdateHpMpTpPacket.h"
|
2018-09-13 22:14:31 +02:00
|
|
|
#include "Network/PacketWrappers/NpcSpawnPacket.h"
|
2018-08-29 21:40:59 +02:00
|
|
|
|
|
|
|
#include "StatusEffect/StatusEffect.h"
|
|
|
|
#include "Action/ActionCollision.h"
|
|
|
|
#include "ServerZone.h"
|
|
|
|
#include "Session.h"
|
|
|
|
#include "Math/CalcBattle.h"
|
|
|
|
#include "Chara.h"
|
|
|
|
#include "Player.h"
|
2018-08-29 22:03:10 +02:00
|
|
|
#include "BNpc.h"
|
2018-09-10 23:57:14 +02:00
|
|
|
#include "BNpcTemplate.h"
|
2018-08-29 21:40:59 +02:00
|
|
|
#include "Zone/TerritoryMgr.h"
|
|
|
|
#include "Framework.h"
|
|
|
|
#include "Common.h"
|
|
|
|
|
|
|
|
extern Core::Framework g_fw;
|
|
|
|
|
|
|
|
using namespace Core::Common;
|
|
|
|
using namespace Core::Network::Packets;
|
|
|
|
using namespace Core::Network::Packets::Server;
|
|
|
|
using namespace Core::Network::ActorControl;
|
|
|
|
|
2018-09-09 23:56:22 +02:00
|
|
|
Core::Entity::BNpc::BNpc() : Npc( ObjKind::BattleNpc )
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-09-13 22:14:31 +02:00
|
|
|
Core::Entity::BNpc::BNpc( BNpcTemplatePtr pTemplate, float posX, float posY, float posZ, uint8_t level ) : Npc( ObjKind::BattleNpc )
|
2018-09-10 23:57:14 +02:00
|
|
|
{
|
|
|
|
m_modelChara = pTemplate->getModelChara();
|
|
|
|
m_displayFlags = pTemplate->getDisplayFlags();
|
|
|
|
m_pose = pTemplate->getPose();
|
|
|
|
m_aggressionMode = pTemplate->getAggressionMode();
|
|
|
|
m_weaponMain = pTemplate->getWeaponMain();
|
|
|
|
m_weaponSub = pTemplate->getWeaponSub();
|
|
|
|
m_bNpcNameId = pTemplate->getBNpcNameId();
|
|
|
|
m_bNpcBaseId = pTemplate->getBNpcBaseId();
|
2018-09-13 22:14:31 +02:00
|
|
|
m_enemyType = pTemplate->getEnemyType();
|
|
|
|
m_pos.x = posX;
|
|
|
|
m_pos.y = posY;
|
|
|
|
m_pos.z = posZ;
|
|
|
|
m_level = level;
|
|
|
|
|
|
|
|
m_maxHp = 200;
|
|
|
|
m_maxMp = 200;
|
|
|
|
m_hp = 200;
|
|
|
|
m_mp = 200;
|
|
|
|
|
|
|
|
m_baseStats.max_hp = 200;
|
|
|
|
m_baseStats.max_mp = 200;
|
2018-09-10 23:57:14 +02:00
|
|
|
|
|
|
|
memcpy( m_customize, pTemplate->getCustomize(), sizeof( m_customize ) );
|
|
|
|
memcpy( m_modelEquip, pTemplate->getModelEquip(), sizeof( m_modelEquip ) );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-08-29 21:40:59 +02:00
|
|
|
Core::Entity::BNpc::~BNpc()
|
|
|
|
{
|
|
|
|
}
|
2018-09-09 23:56:22 +02:00
|
|
|
|
2018-09-13 22:14:31 +02:00
|
|
|
uint8_t Core::Entity::BNpc::getAggressionMode() const
|
|
|
|
{
|
|
|
|
return m_aggressionMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t Core::Entity::BNpc::getEnemyType() const
|
|
|
|
{
|
|
|
|
return m_enemyType;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t Core::Entity::BNpc::getWeaponMain() const
|
2018-09-09 23:56:22 +02:00
|
|
|
{
|
2018-09-13 22:14:31 +02:00
|
|
|
return m_weaponMain;
|
|
|
|
}
|
2018-09-09 23:56:22 +02:00
|
|
|
|
2018-09-13 22:14:31 +02:00
|
|
|
uint64_t Core::Entity::BNpc::getWeaponSub() const
|
|
|
|
{
|
|
|
|
return m_weaponSub;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16_t Core::Entity::BNpc::getModelChara() const
|
|
|
|
{
|
|
|
|
return m_modelChara;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t Core::Entity::BNpc::getLevel() const
|
|
|
|
{
|
|
|
|
return m_level;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t Core::Entity::BNpc::getBNpcBaseId() const
|
|
|
|
{
|
|
|
|
return m_bNpcBaseId;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t Core::Entity::BNpc::getBNpcNameId() const
|
|
|
|
{
|
|
|
|
return m_bNpcNameId;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Core::Entity::BNpc::spawn( PlayerPtr pTarget )
|
|
|
|
{
|
|
|
|
pTarget->queuePacket( boost::make_shared< NpcSpawnPacket >( *getAsBNpc(), *pTarget ) );
|
2018-09-26 03:32:43 -04:00
|
|
|
}
|