mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-28 20:27:46 +00:00
Merge branch 'misc_fix' into action_data_update_pr
This commit is contained in:
commit
8c9228ff34
6 changed files with 30 additions and 10 deletions
|
@ -440,7 +440,7 @@ namespace Sapphire::Network::Packets::Server
|
||||||
*/
|
*/
|
||||||
struct FFXIVIpcEffectResult : FFXIVIpcBasePacket< EffectResult >
|
struct FFXIVIpcEffectResult : FFXIVIpcBasePacket< EffectResult >
|
||||||
{
|
{
|
||||||
uint32_t unknown;
|
uint32_t globalSequence;
|
||||||
uint32_t actor_id;
|
uint32_t actor_id;
|
||||||
uint32_t current_hp;
|
uint32_t current_hp;
|
||||||
uint32_t max_hp;
|
uint32_t max_hp;
|
||||||
|
|
|
@ -447,7 +447,7 @@ void Action::Action::buildEffects()
|
||||||
if( m_disableGenericHandler || !hasValidLutEntry() )
|
if( m_disableGenericHandler || !hasValidLutEntry() )
|
||||||
{
|
{
|
||||||
// send any effect packet added by script or an empty one just to play animation for other players
|
// send any effect packet added by script or an empty one just to play animation for other players
|
||||||
m_effectBuilder->buildAndSendPackets();
|
m_effectBuilder->buildAndSendPackets( getAnimationLock() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,7 +551,7 @@ void Action::Action::buildEffects()
|
||||||
m_effectBuilder->applyStatusEffect( m_pSource, m_pSource, m_lutEntry.selfStatus, m_lutEntry.selfStatusDuration, m_lutEntry.selfStatusParam );
|
m_effectBuilder->applyStatusEffect( m_pSource, m_pSource, m_lutEntry.selfStatus, m_lutEntry.selfStatusDuration, m_lutEntry.selfStatusParam );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_effectBuilder->buildAndSendPackets();
|
m_effectBuilder->buildAndSendPackets( getAnimationLock() );
|
||||||
|
|
||||||
// at this point we're done with it and no longer need it
|
// at this point we're done with it and no longer need it
|
||||||
m_effectBuilder.reset();
|
m_effectBuilder.reset();
|
||||||
|
@ -823,6 +823,22 @@ bool Action::Action::hasValidLutEntry() const
|
||||||
m_lutEntry.targetStatus != 0 || m_lutEntry.gainMPPercentage != 0;
|
m_lutEntry.targetStatus != 0 || m_lutEntry.gainMPPercentage != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Action::Action::getAnimationLock()
|
||||||
|
{
|
||||||
|
switch( static_cast< Common::ActionCategory >( m_actionData->actionCategory ) )
|
||||||
|
{
|
||||||
|
case Common::ActionCategory::Item:
|
||||||
|
{
|
||||||
|
return 1.1f;
|
||||||
|
}
|
||||||
|
case Common::ActionCategory::Mount:
|
||||||
|
{
|
||||||
|
return 0.1f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hasCastTime() ? 0.1f : 0.6f;
|
||||||
|
}
|
||||||
|
|
||||||
Action::EffectBuilderPtr Action::Action::getEffectbuilder()
|
Action::EffectBuilderPtr Action::Action::getEffectbuilder()
|
||||||
{
|
{
|
||||||
return m_effectBuilder;
|
return m_effectBuilder;
|
||||||
|
|
|
@ -126,8 +126,8 @@ namespace Sapphire::World::Action
|
||||||
Entity::CharaPtr getHitChara();
|
Entity::CharaPtr getHitChara();
|
||||||
|
|
||||||
Data::ActionPtr getActionData() const;
|
Data::ActionPtr getActionData() const;
|
||||||
|
|
||||||
ActionEntry getActionEntry() const;
|
ActionEntry getActionEntry() const;
|
||||||
|
float getAnimationLock();
|
||||||
|
|
||||||
bool isPhysical() const;
|
bool isPhysical() const;
|
||||||
bool isMagical() const;
|
bool isMagical() const;
|
||||||
|
|
|
@ -28,7 +28,7 @@ uint64_t EffectBuilder::getResultDelayMs()
|
||||||
{
|
{
|
||||||
// todo: actually figure this retarded shit out
|
// todo: actually figure this retarded shit out
|
||||||
|
|
||||||
return Common::Util::getTimeMs() + 850;
|
return Common::Util::getTimeMs() + 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectBuilder::moveToResultList( Entity::CharaPtr& chara, EffectResultPtr result )
|
void EffectBuilder::moveToResultList( Entity::CharaPtr& chara, EffectResultPtr result )
|
||||||
|
@ -105,7 +105,7 @@ void EffectBuilder::statusNoEffect( Entity::CharaPtr& target, uint16_t statusId
|
||||||
moveToResultList( target, nextResult );
|
moveToResultList( target, nextResult );
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectBuilder::buildAndSendPackets()
|
void EffectBuilder::buildAndSendPackets( float animationLock )
|
||||||
{
|
{
|
||||||
auto targetCount = m_resolvedEffects.size();
|
auto targetCount = m_resolvedEffects.size();
|
||||||
//Logger::debug( "EffectBuilder result: " );
|
//Logger::debug( "EffectBuilder result: " );
|
||||||
|
@ -115,13 +115,13 @@ void EffectBuilder::buildAndSendPackets()
|
||||||
|
|
||||||
do // we want to send at least one packet even nothing is hit so other players can see
|
do // we want to send at least one packet even nothing is hit so other players can see
|
||||||
{
|
{
|
||||||
auto packet = buildNextEffectPacket( globalSequence );
|
auto packet = buildNextEffectPacket( globalSequence, animationLock );
|
||||||
m_sourceChara->sendToInRangeSet( packet, true );
|
m_sourceChara->sendToInRangeSet( packet, true );
|
||||||
}
|
}
|
||||||
while( !m_resolvedEffects.empty() );
|
while( !m_resolvedEffects.empty() );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( uint32_t globalSequence )
|
std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( uint32_t globalSequence, float animationLock )
|
||||||
{
|
{
|
||||||
auto remainingTargetCount = m_resolvedEffects.size();
|
auto remainingTargetCount = m_resolvedEffects.size();
|
||||||
|
|
||||||
|
@ -190,6 +190,7 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( uint32_
|
||||||
pHeader->effectCount = static_cast< uint8_t >( remainingTargetCount > packetSize ? packetSize : remainingTargetCount );
|
pHeader->effectCount = static_cast< uint8_t >( remainingTargetCount > packetSize ? packetSize : remainingTargetCount );
|
||||||
pHeader->sourceSequence = m_sequence;
|
pHeader->sourceSequence = m_sequence;
|
||||||
pHeader->globalSequence = globalSequence;
|
pHeader->globalSequence = globalSequence;
|
||||||
|
pHeader->animationLockTime = animationLock;
|
||||||
|
|
||||||
uint8_t targetIndex = 0;
|
uint8_t targetIndex = 0;
|
||||||
for( auto it = m_resolvedEffects.begin(); it != m_resolvedEffects.end(); )
|
for( auto it = m_resolvedEffects.begin(); it != m_resolvedEffects.end(); )
|
||||||
|
@ -234,6 +235,7 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( uint32_
|
||||||
auto effectPacket = std::make_shared< Server::EffectPacket >( m_sourceChara->getId(), firstResult->getTarget()->getId(), m_actionId );
|
auto effectPacket = std::make_shared< Server::EffectPacket >( m_sourceChara->getId(), firstResult->getTarget()->getId(), m_actionId );
|
||||||
effectPacket->setRotation( Common::Util::floatToUInt16Rot( m_sourceChara->getRot() ) );
|
effectPacket->setRotation( Common::Util::floatToUInt16Rot( m_sourceChara->getRot() ) );
|
||||||
effectPacket->setSequence( seq, m_sequence );
|
effectPacket->setSequence( seq, m_sequence );
|
||||||
|
effectPacket->data().animationLockTime = animationLock;
|
||||||
|
|
||||||
for( int i = 0; i < resultList->size(); i++ )
|
for( int i = 0; i < resultList->size(); i++ )
|
||||||
{
|
{
|
||||||
|
@ -261,6 +263,7 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( uint32_
|
||||||
effectPacket->data().effectCount = 0;
|
effectPacket->data().effectCount = 0;
|
||||||
effectPacket->data().sourceSequence = m_sequence;
|
effectPacket->data().sourceSequence = m_sequence;
|
||||||
effectPacket->data().globalSequence = globalSequence;
|
effectPacket->data().globalSequence = globalSequence;
|
||||||
|
effectPacket->data().animationLockTime = animationLock;
|
||||||
|
|
||||||
return effectPacket;
|
return effectPacket;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,14 +31,14 @@ namespace Sapphire::World::Action
|
||||||
|
|
||||||
void statusNoEffect( Entity::CharaPtr& target, uint16_t statusId );
|
void statusNoEffect( Entity::CharaPtr& target, uint16_t statusId );
|
||||||
|
|
||||||
void buildAndSendPackets();
|
void buildAndSendPackets( float animationLock );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void moveToResultList( Entity::CharaPtr& chara, EffectResultPtr result );
|
void moveToResultList( Entity::CharaPtr& chara, EffectResultPtr result );
|
||||||
|
|
||||||
uint64_t getResultDelayMs();
|
uint64_t getResultDelayMs();
|
||||||
|
|
||||||
std::shared_ptr< Sapphire::Network::Packets::FFXIVPacketBase > buildNextEffectPacket( uint32_t globalSequence );
|
std::shared_ptr< Sapphire::Network::Packets::FFXIVPacketBase > buildNextEffectPacket( uint32_t globalSequence, float animationLock );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t m_actionId;
|
uint32_t m_actionId;
|
||||||
|
|
|
@ -499,6 +499,7 @@ void Sapphire::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEf
|
||||||
|
|
||||||
auto statusEffectAdd = makeZonePacket< FFXIVIpcEffectResult >( getId() );
|
auto statusEffectAdd = makeZonePacket< FFXIVIpcEffectResult >( getId() );
|
||||||
|
|
||||||
|
statusEffectAdd->data().globalSequence = getCurrentTerritory()->getNextEffectSequence();
|
||||||
statusEffectAdd->data().actor_id = pEffect->getTargetActorId();
|
statusEffectAdd->data().actor_id = pEffect->getTargetActorId();
|
||||||
statusEffectAdd->data().current_hp = getHp();
|
statusEffectAdd->data().current_hp = getHp();
|
||||||
statusEffectAdd->data().current_mp = static_cast< uint16_t >( getMp() );
|
statusEffectAdd->data().current_mp = static_cast< uint16_t >( getMp() );
|
||||||
|
|
Loading…
Add table
Reference in a new issue