1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-01 08:27:46 +00:00

preserve chara effects across zones and show them to other in range players.

This commit is contained in:
collett 2023-02-07 05:41:13 +09:00
parent df35893d8f
commit c4695ba3fd
3 changed files with 36 additions and 4 deletions

View file

@ -38,7 +38,8 @@ Sapphire::Entity::Chara::Chara( ObjKind type ) :
m_pose( 0 ), m_pose( 0 ),
m_targetId( INVALID_GAME_OBJECT_ID64 ), m_targetId( INVALID_GAME_OBJECT_ID64 ),
m_directorId( 0 ), m_directorId( 0 ),
m_radius( 1.f ) m_radius( 1.f ),
m_effect( 0 )
{ {
m_lastTickTime = 0; m_lastTickTime = 0;
@ -911,6 +912,25 @@ uint32_t Sapphire::Entity::Chara::getStatValue( Sapphire::Common::BaseParam base
return value + getBonusStat( baseParam ); return value + getBonusStat( baseParam );
} }
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() void Sapphire::Entity::Chara::onTick()
{ {
uint32_t thisTickDmg = 0; uint32_t thisTickDmg = 0;

View file

@ -135,6 +135,8 @@ namespace Sapphire::Entity
/*! Detour Crowd actor scale */ /*! Detour Crowd actor scale */
float m_radius; float m_radius;
uint32_t m_effect;
public: public:
Chara( Common::ObjKind type ); Chara( Common::ObjKind type );
@ -289,6 +291,10 @@ namespace Sapphire::Entity
Common::BaseParam getPrimaryStat() const; Common::BaseParam getPrimaryStat() const;
uint32_t getVisualEffect();
void setVisualEffect( uint32_t effect, bool sendPacket = true );
void sendVisualEffect();
}; };
} }

View file

@ -456,9 +456,15 @@ void Sapphire::World::Manager::DebugCommandMgr::set( char* data, Entity::Player&
{ {
int32_t id; int32_t id;
sscanf( params.c_str(), "%d", &id ); sscanf( params.c_str(), "%d", &id );
auto pPacket = makeZonePacket< FFXIVIpcCharaVisualEffect >( player.getId() ); for( auto actor : player.getInRangeActors() )
pPacket->data().id = id; {
player.queuePacket( pPacket ); if( actor->getId() == player.getTargetId() )
{
actor->getAsChara()->setVisualEffect( id );
return;
}
}
player.setVisualEffect( id );
} }
else else
{ {