diff --git a/src/world/Action/ActionCast.cpp b/src/world/Action/ActionCast.cpp deleted file mode 100644 index 56f0c79d..00000000 --- a/src/world/Action/ActionCast.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "Network/PacketWrappers/ActorControlPacket142.h" -#include "Network/PacketWrappers/ActorControlPacket143.h" -#include "Network/PacketWrappers/ActorControlPacket144.h" - -#include "Actor/Player.h" - -#include "Script/ScriptMgr.h" - -#include "ActionCast.h" -#include "Framework.h" - -using namespace Sapphire::Common; -using namespace Sapphire::Network; -using namespace Sapphire::Network::Packets; -using namespace Sapphire::Network::Packets::Server; -using namespace Sapphire::Network::ActorControl; - -Sapphire::Action::ActionCast::ActionCast() -{ - m_handleActionType = Common::HandleActionType::Event; -} - -Sapphire::Action::ActionCast::ActionCast( Entity::CharaPtr pActor, Entity::CharaPtr pTarget, - uint16_t actionId, FrameworkPtr pFw ) -{ - m_pFw = pFw; - auto pExdData = m_pFw->get< Data::ExdDataGenerated >(); - m_startTime = 0; - m_id = actionId; - m_handleActionType = HandleActionType::Spell; - m_castTime = pExdData->get< Sapphire::Data::Action >( actionId )->cast100ms * 100; // TODO: Add security checks. - m_pSource = pActor; - m_pTarget = pTarget; - m_bInterrupt = false; -} - -Sapphire::Action::ActionCast::~ActionCast() = default; - -void Sapphire::Action::ActionCast::onStart() -{ - if( !m_pSource ) - return; - - m_pSource->getAsPlayer()->sendDebug( "onStart()" ); - m_startTime = Util::getTimeMs(); - - auto castPacket = makeZonePacket< FFXIVIpcActorCast >( getId() ); - - castPacket->data().action_id = m_id; - castPacket->data().skillType = Common::SkillType::Normal; - castPacket->data().unknown_1 = m_id; - // This is used for the cast bar above the target bar of the caster. - castPacket->data().cast_time = static_cast< float >( m_castTime / 1000 ); - castPacket->data().target_id = m_pTarget->getId(); - - m_pSource->sendToInRangeSet( castPacket, true ); - m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Casting ); - -} - -void Sapphire::Action::ActionCast::onFinish() -{ - if( !m_pSource ) - return; - - auto pScriptMgr = m_pFw->get< Scripting::ScriptMgr >(); - - auto pPlayer = m_pSource->getAsPlayer(); - pPlayer->sendDebug( "onFinish()" ); - - pPlayer->unsetStateFlag( PlayerStateFlag::Casting ); - - /*auto control = ActorControlPacket143( m_pTarget->getId(), ActorControlType::Unk7, - 0x219, m_id, m_id, m_id, m_id ); - m_pSource->sendToInRangeSet( control, true );*/ - - pScriptMgr->onCastFinish( *pPlayer, m_pTarget, m_id ); -} - -void Sapphire::Action::ActionCast::onInterrupt() -{ - if( !m_pSource ) - return; - - //m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 ); - m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting ); - - auto control = makeActorControl142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 1, m_id, 0 ); - - // Note: When cast interrupt from taking too much damage, set the last value to 1. This enables the cast interrupt effect. Example: - // auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 1, m_id, 0 ); - - m_pSource->sendToInRangeSet( control, true ); - -} diff --git a/src/world/Action/ActionCast.h b/src/world/Action/ActionCast.h deleted file mode 100644 index 3a3b01b0..00000000 --- a/src/world/Action/ActionCast.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _ACTIONCAST_H_ -#define _ACTIONCAST_H_ - -#include "ForwardsZone.h" -#include "Action.h" - -namespace Sapphire::Action -{ - - class ActionCast : public Action - { - private: - - public: - ActionCast(); - - ~ActionCast(); - - ActionCast( Entity::CharaPtr pActor, Entity::CharaPtr pTarget, uint16_t actionId, FrameworkPtr pFw ); - - void onStart() override; - - void onFinish() override; - - void onInterrupt() override; - - }; - -} - -#endif diff --git a/src/world/Network/Handlers/ActionHandler.cpp b/src/world/Network/Handlers/ActionHandler.cpp index eb70eab8..9d50a599 100644 --- a/src/world/Network/Handlers/ActionHandler.cpp +++ b/src/world/Network/Handlers/ActionHandler.cpp @@ -21,7 +21,6 @@ #include "Manager/ActionMgr.h" #include "Action/Action.h" -#include "Action/ActionCast.h" #include "Script/ScriptMgr.h" #include "Session.h"