mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-28 15:17:46 +00:00
kinda working effect packets
This commit is contained in:
parent
2581840921
commit
d11fa5a6a5
7 changed files with 44 additions and 25 deletions
|
@ -35,19 +35,21 @@ using namespace Sapphire::World;
|
|||
Action::Action::Action() = default;
|
||||
Action::Action::~Action() = default;
|
||||
|
||||
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, FrameworkPtr fw ) :
|
||||
Action( std::move( caster ), actionId, nullptr, std::move( fw ) )
|
||||
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence, FrameworkPtr fw ) :
|
||||
Action( std::move( caster ), actionId, sequence, nullptr, std::move( fw ) )
|
||||
{
|
||||
}
|
||||
|
||||
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, Data::ActionPtr actionData, FrameworkPtr fw ) :
|
||||
Action::Action::Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence,
|
||||
Data::ActionPtr actionData, FrameworkPtr fw ) :
|
||||
m_pSource( std::move( caster ) ),
|
||||
m_pFw( std::move( fw ) ),
|
||||
m_actionData( std::move( actionData ) ),
|
||||
m_id( actionId ),
|
||||
m_targetId( 0 ),
|
||||
m_startTime( 0 ),
|
||||
m_interruptType( Common::ActionInterruptType::None )
|
||||
m_interruptType( Common::ActionInterruptType::None ),
|
||||
m_sequence( sequence )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -70,7 +72,7 @@ bool Action::Action::init()
|
|||
m_actionData = actionData;
|
||||
}
|
||||
|
||||
m_effectBuilder = make_EffectBuilder( m_pSource, getId() );
|
||||
m_effectBuilder = make_EffectBuilder( m_pSource, getId(), m_sequence );
|
||||
|
||||
m_castTimeMs = static_cast< uint32_t >( m_actionData->cast100ms * 100 );
|
||||
m_recastTimeMs = static_cast< uint32_t >( m_actionData->recast100ms * 100 );
|
||||
|
|
|
@ -20,8 +20,8 @@ namespace Sapphire::World::Action
|
|||
public:
|
||||
|
||||
Action();
|
||||
Action( Entity::CharaPtr caster, uint32_t actionId, FrameworkPtr fw );
|
||||
Action( Entity::CharaPtr caster, uint32_t actionId, Data::ActionPtr actionData, FrameworkPtr fw );
|
||||
Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence, FrameworkPtr fw );
|
||||
Action( Entity::CharaPtr caster, uint32_t actionId, uint16_t sequence, Data::ActionPtr actionData, FrameworkPtr fw );
|
||||
|
||||
virtual ~Action();
|
||||
|
||||
|
@ -141,6 +141,8 @@ namespace Sapphire::World::Action
|
|||
|
||||
uint32_t m_id;
|
||||
|
||||
uint16_t m_sequence;
|
||||
|
||||
Common::ActionPrimaryCostType m_primaryCostType;
|
||||
uint16_t m_primaryCost;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "EffectBuilder.h"
|
||||
#include "EffectResult.h"
|
||||
|
||||
#include <Actor/Chara.h>
|
||||
#include <Actor/Player.h>
|
||||
|
||||
#include <Network/PacketWrappers/EffectPacket.h>
|
||||
|
||||
|
@ -16,9 +16,10 @@ using namespace Sapphire;
|
|||
using namespace Sapphire::World::Action;
|
||||
using namespace Sapphire::Network::Packets;
|
||||
|
||||
EffectBuilder::EffectBuilder( Entity::CharaPtr source, uint32_t actionId ) :
|
||||
EffectBuilder::EffectBuilder( Entity::CharaPtr source, uint32_t actionId, uint16_t sequence ) :
|
||||
m_sourceChara( std::move( source ) ),
|
||||
m_actionId( actionId )
|
||||
m_actionId( actionId ),
|
||||
m_sequence( sequence )
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -77,13 +78,25 @@ void EffectBuilder::buildAndSendPackets()
|
|||
|
||||
auto effectPacket = std::make_shared< Server::EffectPacket >( m_sourceChara->getId(), result->getTarget()->getId(), m_actionId );
|
||||
effectPacket->setRotation( Common::Util::floatToUInt16Rot( m_sourceChara->getRot() ) );
|
||||
effectPacket->setSequence( m_sequence );
|
||||
|
||||
effectPacket->addEffect( result->buildEffectEntry() );
|
||||
|
||||
auto sequence = m_sourceChara->getCurrentTerritory()->getNextEffectSequence();
|
||||
effectPacket->setSequence( sequence );
|
||||
m_sourceChara->sendToInRangeSet( effectPacket, false );
|
||||
|
||||
m_sourceChara->sendToInRangeSet( effectPacket, true );
|
||||
// send a dupe packet to the caster with hiddenAnimation field set
|
||||
if( auto player = m_sourceChara->getAsPlayer() )
|
||||
{
|
||||
auto effectPacket2 = std::make_shared< Server::EffectPacket >( m_sourceChara->getId(), result->getTarget()->getId(), m_actionId );
|
||||
effectPacket2->setRotation( Common::Util::floatToUInt16Rot( m_sourceChara->getRot() ) );
|
||||
effectPacket2->setSequence( m_sequence );
|
||||
|
||||
effectPacket2->data().hiddenAnimation = m_sequence;
|
||||
|
||||
effectPacket2->addEffect( result->buildEffectEntry() );
|
||||
|
||||
player->queuePacket( effectPacket2 );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,7 @@ namespace Sapphire::World::Action
|
|||
CriticalDirectHit
|
||||
};
|
||||
|
||||
EffectBuilder( Entity::CharaPtr source, uint32_t actionId );
|
||||
EffectBuilder( Entity::CharaPtr source, uint32_t actionId, uint16_t sequence );
|
||||
|
||||
|
||||
void healTarget( Entity::CharaPtr& target, uint32_t amount,
|
||||
|
@ -34,11 +34,11 @@ namespace Sapphire::World::Action
|
|||
|
||||
uint32_t getResultDelayMs();
|
||||
|
||||
private:
|
||||
uint32_t m_actionId;
|
||||
uint16_t m_sequence;
|
||||
|
||||
Entity::CharaPtr m_sourceChara;
|
||||
|
||||
uint32_t m_actionId;
|
||||
|
||||
std::unordered_map< uint32_t, EffectResultPtr > m_resolvedEffects;
|
||||
};
|
||||
|
||||
|
|
|
@ -19,12 +19,13 @@ World::Manager::ActionMgr::ActionMgr( Sapphire::FrameworkPtr pFw ) :
|
|||
}
|
||||
|
||||
void World::Manager::ActionMgr::handlePlacedPlayerAction( Entity::Player& player, uint32_t actionId,
|
||||
Data::ActionPtr actionData, Common::FFXIVARR_POSITION3 pos )
|
||||
Data::ActionPtr actionData, Common::FFXIVARR_POSITION3 pos,
|
||||
uint16_t sequence )
|
||||
{
|
||||
player.sendDebug( "got aoe act: {0}", actionData->name );
|
||||
|
||||
|
||||
auto action = Action::make_Action( player.getAsPlayer(), actionId, actionData, framework() );
|
||||
auto action = Action::make_Action( player.getAsPlayer(), actionId, sequence, actionData, framework() );
|
||||
|
||||
if( !action->init() )
|
||||
return;
|
||||
|
@ -42,9 +43,10 @@ void World::Manager::ActionMgr::handlePlacedPlayerAction( Entity::Player& player
|
|||
}
|
||||
|
||||
void World::Manager::ActionMgr::handleTargetedPlayerAction( Entity::Player& player, uint32_t actionId,
|
||||
Data::ActionPtr actionData, uint64_t targetId )
|
||||
Data::ActionPtr actionData, uint64_t targetId,
|
||||
uint16_t sequence )
|
||||
{
|
||||
auto action = Action::make_Action( player.getAsPlayer(), actionId, actionData, framework() );
|
||||
auto action = Action::make_Action( player.getAsPlayer(), actionId, sequence, actionData, framework() );
|
||||
|
||||
action->setTargetId( targetId );
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ namespace Sapphire::World::Manager
|
|||
~ActionMgr() = default;
|
||||
|
||||
void handleTargetedPlayerAction( Entity::Player& player, uint32_t actionId,
|
||||
Data::ActionPtr actionData, uint64_t targetId );
|
||||
Data::ActionPtr actionData, uint64_t targetId, uint16_t sequence );
|
||||
void handlePlacedPlayerAction( Entity::Player& player, uint32_t actionId,
|
||||
Data::ActionPtr actionData, Common::FFXIVARR_POSITION3 pos );
|
||||
Data::ActionPtr actionData, Common::FFXIVARR_POSITION3 pos, uint16_t sequence );
|
||||
|
||||
void handleItemAction( Entity::Player& player, uint32_t itemId, Data::ItemActionPtr itemActionData,
|
||||
uint16_t itemSourceSlot, uint16_t itemSourceContainer );
|
||||
|
|
|
@ -48,7 +48,7 @@ void Sapphire::Network::GameConnection::actionHandler( FrameworkPtr pFw,
|
|||
if( !action )
|
||||
return;
|
||||
|
||||
actionMgr->handleTargetedPlayerAction( player, actionId, action, targetId );
|
||||
actionMgr->handleTargetedPlayerAction( player, actionId, action, targetId, sequence );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -112,5 +112,5 @@ void Sapphire::Network::GameConnection::placedActionHandler( FrameworkPtr pFw,
|
|||
return;
|
||||
|
||||
auto actionMgr = pFw->get< World::Manager::ActionMgr >();
|
||||
actionMgr->handlePlacedPlayerAction( player, actionId, action, pos );
|
||||
actionMgr->handlePlacedPlayerAction( player, actionId, action, pos, sequence );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue