mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 16:37:45 +00:00
Fixed event item action, also changed the way the action interrupt grace period works
This commit is contained in:
parent
7fa20f2a3a
commit
f093aba377
6 changed files with 22 additions and 6 deletions
|
@ -240,7 +240,8 @@ bool Action::Action::update()
|
|||
|
||||
player->setLastActionTick( tickCount );
|
||||
uint32_t delayMs = 100 - lastTickMs;
|
||||
castTime = ( m_castTimeMs + delayMs ) - 500; //subtract 500ms before the client begin to request actions while casting
|
||||
castTime = ( m_castTimeMs + delayMs ); //subtract 500ms before the client begin to request actions while casting
|
||||
m_castTimeRestMs = static_cast< uint64_t >( m_castTimeMs ) - std::difftime( static_cast< time_t >( tickCount ), static_cast< time_t >( m_startTime ) );
|
||||
}
|
||||
|
||||
if( !hasCastTime() || std::difftime( static_cast< time_t >( tickCount ), static_cast< time_t >( m_startTime ) ) > castTime )
|
||||
|
@ -872,3 +873,8 @@ void Action::Action::setActionKind( uint8_t actionKind )
|
|||
{
|
||||
m_actionKind = actionKind;
|
||||
}
|
||||
|
||||
uint64_t Action::Action::getCastTimeRest() const
|
||||
{
|
||||
return m_castTimeRestMs;
|
||||
}
|
||||
|
|
|
@ -49,6 +49,8 @@ namespace Sapphire::World::Action
|
|||
uint8_t getActionKind() const;
|
||||
void setActionKind( uint8_t actionKind );
|
||||
|
||||
uint64_t getCastTimeRest() const;
|
||||
|
||||
/*!
|
||||
* @brief Checks if a chara has enough resources available to cast the action (tp/mp/etc)
|
||||
* @return true if they have the required resources
|
||||
|
@ -161,6 +163,7 @@ namespace Sapphire::World::Action
|
|||
uint16_t m_primaryCost;
|
||||
|
||||
uint64_t m_startTime;
|
||||
uint64_t m_castTimeRestMs;
|
||||
uint32_t m_castTimeMs;
|
||||
uint32_t m_recastTimeMs;
|
||||
uint8_t m_cooldownGroup;
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include <Network/PacketWrappers/EffectPacket.h>
|
||||
|
||||
#include "Manager/PlayerMgr.h"
|
||||
#include "Manager/EventMgr.h"
|
||||
|
||||
#include "Script/ScriptMgr.h"
|
||||
#include <Service.h>
|
||||
#include <Network/CommonActorControl.h>
|
||||
|
@ -56,8 +58,13 @@ void EventItemAction::execute()
|
|||
{
|
||||
Manager::PlayerMgr::sendDebug( *getSourceChara()->getAsPlayer(), "EventItemAction type {0} execute called.", m_eventItemAction->data().Action );
|
||||
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||
auto& eventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
|
||||
eventMgr.eventStart( *getSourceChara()->getAsPlayer(), m_targetId, m_eventItemAction->data().EventHandler,
|
||||
Event::EventHandler::ActionResult, 0, 0 );
|
||||
|
||||
scriptMgr.onEventItem( *getSourceChara()->getAsPlayer(), m_eventItem, m_eventItemAction->data().EventHandler, m_targetId );
|
||||
eventMgr.checkEvent( *getSourceChara()->getAsPlayer(), m_eventItemAction->data().EventHandler );
|
||||
}
|
||||
|
||||
void EventItemAction::onStart()
|
||||
|
|
|
@ -75,9 +75,7 @@ void Sapphire::Network::GameConnection::actionRequest( const Packets::FFXIVARR_P
|
|||
{
|
||||
auto action = exdData.getRow< Component::Excel::EventItem >( actionId );
|
||||
assert( action );
|
||||
|
||||
actionMgr.handleEventItemAction( player, actionId, action, sequence, targetId );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ void Sapphire::Network::GameConnection::moveHandler( const Packets::FFXIVARR_PAC
|
|||
player.setRot( data.dir );
|
||||
player.setPos( { data.pos.x, data.pos.y, data.pos.z } );
|
||||
|
||||
if( player.getCurrentAction() && bPosChanged )
|
||||
if( player.getCurrentAction() && bPosChanged && player.getCurrentAction()->getCastTimeRest() > 500 )
|
||||
player.getCurrentAction()->setInterrupted( Common::ActionInterruptType::RegularInterrupt );
|
||||
|
||||
auto clientAnimationType = data.flag;
|
||||
|
|
|
@ -284,6 +284,8 @@ bool Sapphire::Scripting::ScriptMgr::onEmote( Entity::Player& player, uint64_t a
|
|||
{
|
||||
const auto eventType = static_cast< uint16_t >( eventId >> 16 );
|
||||
|
||||
auto& pEventMgr = Common::Service< World::Manager::EventMgr >::ref();
|
||||
auto actor = pEventMgr.mapEventActorToRealActor( static_cast< uint32_t >( actorId ) );
|
||||
if( eventType == Event::EventHandler::EventHandlerType::Quest )
|
||||
{
|
||||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::QuestScript >( eventId );
|
||||
|
@ -293,7 +295,7 @@ bool Sapphire::Scripting::ScriptMgr::onEmote( Entity::Player& player, uint64_t a
|
|||
{
|
||||
auto idx = player.getQuestIndex( eventId );
|
||||
auto& quest = player.getQuestByIndex( idx );
|
||||
script->onEmote( quest, actorId, emoteId, player );
|
||||
script->onEmote( quest, actor, emoteId, player );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -301,7 +303,7 @@ bool Sapphire::Scripting::ScriptMgr::onEmote( Entity::Player& player, uint64_t a
|
|||
auto script = m_nativeScriptMgr->getScript< Sapphire::ScriptAPI::EventScript >( eventId );
|
||||
if( !script )
|
||||
return false;
|
||||
script->onEmote( actorId, eventId, emoteId, player );
|
||||
script->onEmote( actor, eventId, emoteId, player );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue