mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 06:47:45 +00:00
Fix skill animation for other players.
This commit is contained in:
parent
4deac81abd
commit
e6c3e327f7
2 changed files with 29 additions and 16 deletions
|
@ -752,19 +752,17 @@ bool Action::Action::preFilterActor( Sapphire::Entity::Actor& actor ) const
|
|||
if( kind != ObjKind::BattleNpc && kind != ObjKind::Player )
|
||||
return false;
|
||||
|
||||
if( m_lutEntry.potency > 0 && chara->getId() == m_pSource->getId() )
|
||||
{
|
||||
// damage action shouldn't hit self
|
||||
if( !m_canTargetSelf && chara->getId() == m_pSource->getId() )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( ( m_lutEntry.potency > 0 || m_lutEntry.curePotency > 0 ) && !chara->isAlive() )
|
||||
{
|
||||
// can't deal damage or heal a dead entity
|
||||
if( ( m_lutEntry.potency > 0 || m_lutEntry.curePotency > 0 ) && !chara->isAlive() ) // !m_canTargetDead not working for aoe
|
||||
return false;
|
||||
}
|
||||
|
||||
// todo: handle things such based on canTargetX
|
||||
if( m_lutEntry.potency > 0 && m_pSource->getObjKind() == chara->getObjKind() ) // !m_canTargetFriendly not working for aoe
|
||||
return false;
|
||||
|
||||
if( ( m_lutEntry.potency == 0 && m_lutEntry.curePotency > 0 ) && m_pSource->getObjKind() != chara->getObjKind() ) // !m_canTargetHostile not working for aoe
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -105,11 +105,12 @@ void EffectBuilder::buildAndSendPackets()
|
|||
|
||||
auto globalSequence = m_sourceChara->getCurrentTerritory()->getNextEffectSequence();
|
||||
|
||||
while( !m_resolvedEffects.empty() )
|
||||
do // we want to send at least one packet even nothing is hit so other players can see
|
||||
{
|
||||
auto packet = buildNextEffectPacket( globalSequence );
|
||||
m_sourceChara->sendToInRangeSet( packet, true );
|
||||
}
|
||||
while( !m_resolvedEffects.empty() );
|
||||
}
|
||||
|
||||
std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( uint32_t globalSequence )
|
||||
|
@ -118,9 +119,7 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( uint32_
|
|||
|
||||
if( remainingTargetCount > 1 ) // use AoeEffect packets
|
||||
{
|
||||
int packetSize = remainingTargetCount <= 8 ? 8 :
|
||||
( remainingTargetCount <= 16 ? 16 :
|
||||
( remainingTargetCount <= 24 ? 24 : 32 ) );
|
||||
int packetSize = remainingTargetCount <= 8 ? 8 : ( remainingTargetCount <= 16 ? 16 : ( remainingTargetCount <= 24 ? 24 : 32 ) );
|
||||
|
||||
using EffectHeader = Server::FFXIVIpcAoeEffect< 8 >; // dummy type to access header part of the packet
|
||||
|
||||
|
@ -215,7 +214,7 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( uint32_
|
|||
|
||||
return effectPacket;
|
||||
}
|
||||
else
|
||||
else if ( remainingTargetCount == 1 ) // use Effect for single target
|
||||
{
|
||||
auto resultList = m_resolvedEffects.begin()->second;
|
||||
assert( !resultList->empty() );
|
||||
|
@ -239,6 +238,22 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( uint32_
|
|||
|
||||
m_resolvedEffects.clear();
|
||||
|
||||
return effectPacket;
|
||||
}
|
||||
else // nothing is hit, this only happens when using aoe and AoeEffect8 is used on retail
|
||||
{
|
||||
auto effectPacket = makeZonePacket< Server::FFXIVIpcAoeEffect8 >( m_sourceChara->getId() );
|
||||
|
||||
effectPacket->data().actionId = m_actionId;
|
||||
effectPacket->data().actionAnimationId = static_cast< uint16_t >( m_actionId );
|
||||
effectPacket->data().animationTargetId = m_sourceChara->getId();
|
||||
effectPacket->data().someTargetId = 0xE0000000;
|
||||
effectPacket->data().rotation = Common::Util::floatToUInt16Rot( m_sourceChara->getRot() );
|
||||
effectPacket->data().effectDisplayType = Common::ActionEffectDisplayType::HideActionName;
|
||||
effectPacket->data().effectCount = 0;
|
||||
effectPacket->data().sourceSequence = m_sequence;
|
||||
effectPacket->data().globalSequence = globalSequence;
|
||||
|
||||
return effectPacket;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue