mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-28 23:27:45 +00:00
ActionMount;
This commit is contained in:
parent
30aa9fe211
commit
240e06a634
6 changed files with 152 additions and 19 deletions
|
@ -604,7 +604,8 @@ struct FFXIVIpcActorSetPos : FFXIVIpcBasePacket<ActorSetPos>
|
|||
struct FFXIVIpcActorCast : FFXIVIpcBasePacket<ActorCast>
|
||||
{
|
||||
uint16_t action_id;
|
||||
uint16_t unknown;
|
||||
Common::SkillType skillType;
|
||||
uint8_t unknown;
|
||||
uint32_t unknown_1; // Also action id
|
||||
float cast_time;
|
||||
uint32_t target_id;
|
||||
|
|
|
@ -53,7 +53,7 @@ void Core::Action::ActionCast::onStart()
|
|||
GamePacketNew< FFXIVIpcActorCast, ServerZoneIpcType > castPacket( m_pSource->getId() );
|
||||
|
||||
castPacket.data().action_id = m_id;
|
||||
castPacket.data().unknown = 1;
|
||||
castPacket.data().skillType = Common::SkillType::Normal;
|
||||
castPacket.data().unknown_1 = m_id;
|
||||
castPacket.data().cast_time = static_cast< float >( m_castTime / 1000 ); // This is used for the cast bar above the target bar of the caster.
|
||||
castPacket.data().target_id = m_pTarget->getId();
|
||||
|
|
115
src/servers/Server_Zone/Action/ActionMount.cpp
Normal file
115
src/servers/Server_Zone/Action/ActionMount.cpp
Normal file
|
@ -0,0 +1,115 @@
|
|||
#include "ActionMount.h"
|
||||
|
||||
#include <src/servers/Server_Common/Common.h>
|
||||
#include <src/servers/Server_Common/Util/Util.h>
|
||||
#include <src/servers/Server_Common/Util/UtilMath.h>
|
||||
#include <src/servers/Server_Common/Exd/ExdData.h>
|
||||
#include <src/servers/Server_Common/Logging/Logger.h>
|
||||
|
||||
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket142.h"
|
||||
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket143.h"
|
||||
#include "src/servers/Server_Zone/Network/PacketWrappers/ActorControlPacket144.h"
|
||||
#include "src/servers/Server_Zone/Actor/Player.h"
|
||||
#include "src/servers/Server_Zone/Script/ScriptManager.h"
|
||||
|
||||
using namespace Core::Common;
|
||||
using namespace Core::Network;
|
||||
using namespace Core::Network::Packets;
|
||||
using namespace Core::Network::Packets::Server;
|
||||
|
||||
extern Core::Data::ExdData g_exdData;
|
||||
extern Core::Logger g_log;
|
||||
extern Core::Scripting::ScriptManager g_scriptMgr;
|
||||
|
||||
Core::Action::ActionMount::ActionMount()
|
||||
{
|
||||
m_handleActionType = Common::HandleActionType::Event;
|
||||
}
|
||||
|
||||
Core::Action::ActionMount::ActionMount( Entity::ActorPtr pActor, Entity::ActorPtr pTarget, uint32_t actionId )
|
||||
{
|
||||
m_startTime = 0;
|
||||
m_id = actionId;
|
||||
m_handleActionType = HandleActionType::Spell;
|
||||
m_castTime = 1000;
|
||||
m_pSource = pActor;
|
||||
m_pTarget = pTarget;
|
||||
m_bInterrupt = false;
|
||||
}
|
||||
|
||||
Core::Action::ActionMount::~ActionMount()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Core::Action::ActionMount::onStart()
|
||||
{
|
||||
if( !m_pSource )
|
||||
return;
|
||||
|
||||
m_pSource->getAsPlayer()->sendDebug( "ActionMount::onStart()" );
|
||||
m_startTime = Util::getTimeMs();
|
||||
|
||||
GamePacketNew< FFXIVIpcActorCast, ServerZoneIpcType > castPacket( m_pSource->getId() );
|
||||
|
||||
castPacket.data().action_id = m_id;
|
||||
castPacket.data().skillType = Common::SkillType::MountSkill;
|
||||
castPacket.data().unknown_1 = m_id;
|
||||
castPacket.data().cast_time = static_cast< float >( m_castTime / 1000 ); // This is used for the cast bar above the target bar of the caster.
|
||||
castPacket.data().target_id = m_pTarget->getId();
|
||||
|
||||
m_pSource->sendToInRangeSet( castPacket, true );
|
||||
m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Casting );
|
||||
m_pSource->getAsPlayer()->sendStateFlags();
|
||||
|
||||
}
|
||||
|
||||
void Core::Action::ActionMount::onFinish()
|
||||
{
|
||||
if( !m_pSource )
|
||||
return;
|
||||
|
||||
auto pPlayer = m_pSource->getAsPlayer();
|
||||
pPlayer->sendDebug( "ActionMount::onFinish()" );
|
||||
|
||||
pPlayer->unsetStateFlag( PlayerStateFlag::Casting );
|
||||
pPlayer->sendStateFlags();
|
||||
|
||||
GamePacketNew< FFXIVIpcEffect, ServerZoneIpcType > effectPacket(pPlayer->getId());
|
||||
effectPacket.data().targetId = pPlayer->getId();
|
||||
effectPacket.data().actionAnimationId = m_id;
|
||||
effectPacket.data().unknown_62 = 13; // Affects displaying action name next to number in floating text
|
||||
effectPacket.data().actionTextId = 4;
|
||||
effectPacket.data().numEffects = 1;
|
||||
effectPacket.data().rotation = Math::Util::floatToUInt16Rot(pPlayer->getRotation());
|
||||
effectPacket.data().effectTarget = INVALID_GAME_OBJECT_ID;
|
||||
effectPacket.data().effects[0].effectType = ActionEffectType::Mount;
|
||||
effectPacket.data().effects[0].hitSeverity = ActionHitSeverityType::CritDamage;
|
||||
effectPacket.data().effects[0].value = m_id;
|
||||
|
||||
pPlayer->sendToInRangeSet(effectPacket, true);
|
||||
|
||||
pPlayer->sendToInRangeSet(ActorControlPacket142(pPlayer->getId(), ActorControlType::SetStatus, 4), true); //?
|
||||
pPlayer->sendToInRangeSet(ActorControlPacket143(pPlayer->getId(), 0x39e, 12), true); //?
|
||||
|
||||
pPlayer->mount( m_id );
|
||||
}
|
||||
|
||||
void Core::Action::ActionMount::onInterrupt()
|
||||
{
|
||||
if( !m_pSource )
|
||||
return;
|
||||
|
||||
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 );
|
||||
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting );
|
||||
m_pSource->getAsPlayer()->sendStateFlags();
|
||||
|
||||
auto control = ActorControlPacket142( 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 );
|
||||
|
||||
}
|
28
src/servers/Server_Zone/Action/ActionMount.h
Normal file
28
src/servers/Server_Zone/Action/ActionMount.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#ifndef _ACTIONMOUNT_H_
|
||||
#define _ACTIONMOUNT_H_
|
||||
|
||||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
#include "Action.h"
|
||||
|
||||
namespace Core { namespace Action {
|
||||
|
||||
class ActionMount : public Action
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
ActionMount();
|
||||
~ActionMount();
|
||||
|
||||
ActionMount( Entity::ActorPtr pActor, Entity::ActorPtr pTarget, uint32_t actionId );
|
||||
|
||||
void onStart() override;
|
||||
void onFinish() override;
|
||||
void onInterrupt() override;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -44,6 +44,7 @@ namespace Core
|
|||
TYPE_FORWARD( Action );
|
||||
TYPE_FORWARD( ActionTeleport );
|
||||
TYPE_FORWARD( ActionCast );
|
||||
TYPE_FORWARD( ActionMount );
|
||||
TYPE_FORWARD( EventAction );
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#include "src/servers/Server_Zone/Forwards.h"
|
||||
|
||||
#include "src/servers/Server_Zone/Action/Action.h"
|
||||
#include "src/servers/Server_Zone/Action/ActionTeleport.h"
|
||||
#include "src/servers/Server_Zone/Action/ActionCast.h"
|
||||
#include "src/servers/Server_Zone/Action/ActionMount.h"
|
||||
#include "src/servers/Server_Zone/Script/ScriptManager.h"
|
||||
#include "Server_Zone/Network/PacketWrappers/MoveActorPacket.h"
|
||||
|
||||
|
@ -118,22 +118,10 @@ void Core::Network::GameConnection::skillHandler( const Packets::GamePacket& inP
|
|||
|
||||
pPlayer->sendDebug( "Request mount " + std::to_string( action ) );
|
||||
|
||||
GamePacketNew< FFXIVIpcEffect, ServerZoneIpcType > effectPacket(pPlayer->getId());
|
||||
effectPacket.data().targetId = pPlayer->getId();
|
||||
effectPacket.data().actionAnimationId = action;
|
||||
effectPacket.data().unknown_62 = 13; // Affects displaying action name next to number in floating text
|
||||
effectPacket.data().actionTextId = 4;
|
||||
effectPacket.data().numEffects = 1;
|
||||
effectPacket.data().rotation = Math::Util::floatToUInt16Rot(pPlayer->getRotation());
|
||||
effectPacket.data().effectTarget = INVALID_GAME_OBJECT_ID;
|
||||
effectPacket.data().effects[0].effectType = ActionEffectType::Mount;
|
||||
effectPacket.data().effects[0].hitSeverity = ActionHitSeverityType::CritDamage;
|
||||
effectPacket.data().effects[0].value = action;
|
||||
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket142( pPlayer->getId(), ActorControlType::SetStatus, 4 ), true ); //?
|
||||
pPlayer->sendToInRangeSet( ActorControlPacket143( pPlayer->getId(), 0x39e, 12 ), true ); //?
|
||||
pPlayer->mount( action );
|
||||
pPlayer->sendToInRangeSet( effectPacket, true );
|
||||
Action::ActionMountPtr pActionMount(new Action::ActionMount(pPlayer, pPlayer, action));
|
||||
pPlayer->setCurrentAction(pActionMount);
|
||||
pPlayer->sendDebug("setCurrentAction()");
|
||||
pPlayer->getCurrentAction()->onStart();
|
||||
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue