mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-03 17:27:47 +00:00
set correct bnpc animation when aggro'd/passive
This commit is contained in:
parent
a7e070556b
commit
7cef77e2eb
3 changed files with 15 additions and 8 deletions
|
@ -666,7 +666,7 @@ struct FFXIVIpcActorMove :
|
||||||
{
|
{
|
||||||
/* 0000 */ uint8_t rotation;
|
/* 0000 */ uint8_t rotation;
|
||||||
/* 0001 */ uint8_t unknown_1;
|
/* 0001 */ uint8_t unknown_1;
|
||||||
/* 0002 */ uint8_t unknown_2;
|
/* 0002 */ uint8_t animationType;
|
||||||
/* 0003 */ uint8_t unknown_3;
|
/* 0003 */ uint8_t unknown_3;
|
||||||
/* 0004 */ uint16_t unknown_4;
|
/* 0004 */ uint16_t unknown_4;
|
||||||
/* 0006 */ uint16_t posX;
|
/* 0006 */ uint16_t posX;
|
||||||
|
|
|
@ -174,9 +174,9 @@ void Sapphire::Entity::BNpc::step()
|
||||||
// This is probably not a good way to do it but works fine for now
|
// This is probably not a good way to do it but works fine for now
|
||||||
float angle = Util::calcAngFrom( getPos().x, getPos().z, stepPos.x, stepPos.z ) + PI;
|
float angle = Util::calcAngFrom( getPos().x, getPos().z, stepPos.x, stepPos.z ) + PI;
|
||||||
|
|
||||||
auto x = ( cosf( angle ) * 1.7f );
|
auto x = ( cosf( angle ) * .5f );
|
||||||
auto y = stepPos.y;
|
auto y = stepPos.y;
|
||||||
auto z = ( sinf( angle ) * 1.7f );
|
auto z = ( sinf( angle ) * .5f );
|
||||||
|
|
||||||
face( stepPos );
|
face( stepPos );
|
||||||
setPos( { getPos().x + x, y, getPos().z + z } );
|
setPos( { getPos().x + x, y, getPos().z + z } );
|
||||||
|
@ -229,7 +229,14 @@ bool Sapphire::Entity::BNpc::moveTo( const FFXIVARR_POSITION3& pos )
|
||||||
|
|
||||||
void Sapphire::Entity::BNpc::sendPositionUpdate()
|
void Sapphire::Entity::BNpc::sendPositionUpdate()
|
||||||
{
|
{
|
||||||
auto movePacket = std::make_shared< MoveActorPacket >( *getAsChara(), 0x3A, 0, 0, 0x5A );
|
uint8_t unk1 = 0x3a;
|
||||||
|
uint8_t animationType = 2;
|
||||||
|
|
||||||
|
if( m_state == BNpcState::Combat )
|
||||||
|
animationType = 0;
|
||||||
|
|
||||||
|
|
||||||
|
auto movePacket = std::make_shared< MoveActorPacket >( *getAsChara(), unk1, animationType, 0, 0x5A );
|
||||||
sendToInRangeSet( movePacket );
|
sendToInRangeSet( movePacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,19 +19,19 @@ namespace Sapphire::Network::Packets::Server
|
||||||
public ZoneChannelPacket< FFXIVIpcActorMove >
|
public ZoneChannelPacket< FFXIVIpcActorMove >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MoveActorPacket( Entity::Chara& actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 ) :
|
MoveActorPacket( Entity::Chara& actor, uint8_t unk1, uint8_t animationType, uint8_t unk3, uint16_t unk4 ) :
|
||||||
ZoneChannelPacket< FFXIVIpcActorMove >( actor.getId(), actor.getId() )
|
ZoneChannelPacket< FFXIVIpcActorMove >( actor.getId(), actor.getId() )
|
||||||
{
|
{
|
||||||
initialize( actor, unk1, unk2, unk3, unk4 );
|
initialize( actor, unk1, animationType, unk3, unk4 );
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initialize( Entity::Chara& actor, uint8_t unk1, uint8_t unk2, uint8_t unk3, uint16_t unk4 )
|
void initialize( Entity::Chara& actor, uint8_t unk1, uint8_t animationType, uint8_t unk3, uint16_t unk4 )
|
||||||
{
|
{
|
||||||
|
|
||||||
m_data.rotation = Util::floatToUInt8Rot( actor.getRot() );
|
m_data.rotation = Util::floatToUInt8Rot( actor.getRot() );
|
||||||
m_data.unknown_1 = unk1;
|
m_data.unknown_1 = unk1;
|
||||||
m_data.unknown_2 = unk2;
|
m_data.animationType = animationType;
|
||||||
m_data.unknown_3 = unk3;
|
m_data.unknown_3 = unk3;
|
||||||
m_data.unknown_4 = unk4;
|
m_data.unknown_4 = unk4;
|
||||||
m_data.posX = Util::floatToUInt16( actor.getPos().x );
|
m_data.posX = Util::floatToUInt16( actor.getPos().x );
|
||||||
|
|
Loading…
Add table
Reference in a new issue