1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 15:17:46 +00:00

remove old actioncast setup

This commit is contained in:
NotAdam 2019-02-08 22:07:49 +11:00
parent 37e07784cd
commit 1085a3c154
3 changed files with 0 additions and 134 deletions

View file

@ -1,102 +0,0 @@
#include <Common.h>
#include <Util/Util.h>
#include <Util/UtilMath.h>
#include <Logging/Logger.h>
#include <Exd/ExdDataGenerated.h>
#include <Network/CommonActorControl.h>
#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 );
}

View file

@ -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

View file

@ -21,7 +21,6 @@
#include "Manager/ActionMgr.h" #include "Manager/ActionMgr.h"
#include "Action/Action.h" #include "Action/Action.h"
#include "Action/ActionCast.h"
#include "Script/ScriptMgr.h" #include "Script/ScriptMgr.h"
#include "Session.h" #include "Session.h"