diff --git a/src/world/Actor/Chara.cpp b/src/world/Actor/Chara.cpp index 40d69ef3..0fb0f9e1 100644 --- a/src/world/Actor/Chara.cpp +++ b/src/world/Actor/Chara.cpp @@ -38,7 +38,8 @@ Sapphire::Entity::Chara::Chara( ObjKind type ) : m_pose( 0 ), m_targetId( INVALID_GAME_OBJECT_ID64 ), m_directorId( 0 ), - m_radius( 1.f ) + m_radius( 1.f ), + m_effect( 0 ) { m_lastTickTime = 0; @@ -990,6 +991,25 @@ float Sapphire::Entity::Chara::applyShieldProtection( float damage ) return remainingDamage; } +uint32_t Sapphire::Entity::Chara::getVisualEffect() +{ + return m_effect; +} + +void Sapphire::Entity::Chara::setVisualEffect( uint32_t effect, bool sendPacket ) +{ + m_effect = effect; + if( sendPacket ) + sendVisualEffect(); +} + +void Sapphire::Entity::Chara::sendVisualEffect() +{ + auto pPacket = makeZonePacket< FFXIVIpcCharaVisualEffect >( getId() ); + pPacket->data().id = m_effect; + sendToInRangeSet( pPacket, true ); +} + void Sapphire::Entity::Chara::onTick() { uint32_t thisTickDmg = 0; diff --git a/src/world/Actor/Chara.h b/src/world/Actor/Chara.h index 6f228627..d078aa75 100644 --- a/src/world/Actor/Chara.h +++ b/src/world/Actor/Chara.h @@ -134,6 +134,8 @@ namespace Sapphire::Entity /*! Detour Crowd actor scale */ float m_radius; + uint32_t m_effect; + public: Chara( Common::ObjKind type ); @@ -290,6 +292,10 @@ namespace Sapphire::Entity float applyShieldProtection( float damage ); + uint32_t getVisualEffect(); + void setVisualEffect( uint32_t effect, bool sendPacket = true ); + void sendVisualEffect(); + }; } diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index c3fbb828..18a9d1d2 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -83,8 +83,7 @@ Sapphire::Entity::Player::Player() : m_directorInitialized( false ), m_onEnterEventDone( false ), m_falling( false ), - m_pQueuedAction( nullptr ), - m_effect( 0 ) + m_pQueuedAction( nullptr ) { m_id = 0; m_currentStance = Stance::Passive; @@ -2546,25 +2545,6 @@ void Sapphire::Entity::Player::gaugeSetRaw( uint8_t* pData ) sendActorGauge(); } -uint32_t Sapphire::Entity::Player::getVisualEffect() -{ - return m_effect; -} - -void Sapphire::Entity::Player::setVisualEffect( uint32_t effect, bool sendPacket ) -{ - m_effect = effect; - if( sendPacket ); - sendVisualEffect(); -} - -void Sapphire::Entity::Player::sendVisualEffect() -{ - auto pPacket = makeZonePacket< FFXIVIpcCharaVisualEffect >( getId() ); - pPacket->data().id = m_effect; - sendToInRangeSet( pPacket, true ); -} - void Sapphire::Entity::Player::gaugeWarSetIb( uint8_t value ) { assert( value >= 0 && value <= 100 ); diff --git a/src/world/Actor/Player.h b/src/world/Actor/Player.h index 10bc2521..089413e3 100644 --- a/src/world/Actor/Player.h +++ b/src/world/Actor/Player.h @@ -990,10 +990,6 @@ namespace Sapphire::Entity void sendActorGauge(); void gaugeSetRaw( uint8_t* pData ); - uint32_t getVisualEffect(); - void setVisualEffect( uint32_t effect, bool sendPacket = true ); - void sendVisualEffect(); - void gaugeWarSetIb( uint8_t value ); uint8_t gaugeWarGetIb(); @@ -1221,8 +1217,6 @@ namespace Sapphire::Entity std::array< Common::HuntingLogEntry, 12 > m_huntingLogEntries; std::unordered_map< uint32_t, std::vector< ShopBuyBackEntry > > m_shopBuyBackMap; - - uint32_t m_effect; }; } diff --git a/src/world/Manager/DebugCommandMgr.cpp b/src/world/Manager/DebugCommandMgr.cpp index 3f6b85ff..c719877c 100644 --- a/src/world/Manager/DebugCommandMgr.cpp +++ b/src/world/Manager/DebugCommandMgr.cpp @@ -375,6 +375,14 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player& { int32_t id; sscanf( params.c_str(), "%d", &id ); + for( auto actor : player.getInRangeActors() ) + { + if( actor->getId() == player.getTargetId() ) + { + actor->getAsChara()->setVisualEffect( id ); + return; + } + } player.setVisualEffect( id ); } else