1
Fork 0
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:
NotAdam 2019-01-26 11:39:25 +11:00
parent a7e070556b
commit 7cef77e2eb
3 changed files with 15 additions and 8 deletions

View file

@ -666,7 +666,7 @@ struct FFXIVIpcActorMove :
{
/* 0000 */ uint8_t rotation;
/* 0001 */ uint8_t unknown_1;
/* 0002 */ uint8_t unknown_2;
/* 0002 */ uint8_t animationType;
/* 0003 */ uint8_t unknown_3;
/* 0004 */ uint16_t unknown_4;
/* 0006 */ uint16_t posX;

View file

@ -174,9 +174,9 @@ void Sapphire::Entity::BNpc::step()
// 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;
auto x = ( cosf( angle ) * 1.7f );
auto x = ( cosf( angle ) * .5f );
auto y = stepPos.y;
auto z = ( sinf( angle ) * 1.7f );
auto z = ( sinf( angle ) * .5f );
face( stepPos );
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()
{
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 );
}

View file

@ -19,19 +19,19 @@ namespace Sapphire::Network::Packets::Server
public ZoneChannelPacket< FFXIVIpcActorMove >
{
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() )
{
initialize( actor, unk1, unk2, unk3, unk4 );
initialize( actor, unk1, animationType, unk3, unk4 );
};
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.unknown_1 = unk1;
m_data.unknown_2 = unk2;
m_data.animationType = animationType;
m_data.unknown_3 = unk3;
m_data.unknown_4 = unk4;
m_data.posX = Util::floatToUInt16( actor.getPos().x );