mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
Add option for scripts to enable the generic/lut handler
This commit is contained in:
parent
ec3c109898
commit
9daf224019
2 changed files with 14 additions and 2 deletions
|
@ -517,8 +517,9 @@ void Action::Action::handleAction()
|
|||
|
||||
auto& scriptMgr = Common::Service< Scripting::ScriptMgr >::ref();
|
||||
auto hasLutEntry = hasValidLutEntry();
|
||||
auto hasScript = scriptMgr.onExecute( *this );
|
||||
|
||||
if( !scriptMgr.onExecute( *this ) && !hasLutEntry )
|
||||
if( !hasScript && !hasLutEntry )
|
||||
{
|
||||
if( auto player = m_pSource->getAsPlayer() )
|
||||
{
|
||||
|
@ -528,9 +529,12 @@ void Action::Action::handleAction()
|
|||
return;
|
||||
}
|
||||
|
||||
if( !hasScript )
|
||||
m_enableGenericHandler = true;
|
||||
|
||||
Network::Util::Player::sendHudParam( *m_pSource->getAsPlayer() );
|
||||
|
||||
if( !hasLutEntry || m_hitActors.empty() )
|
||||
if( !m_enableGenericHandler || !hasLutEntry || m_hitActors.empty() )
|
||||
{
|
||||
// send any effect packet added by script or an empty one just to play animation for other players
|
||||
m_effectBuilder->buildAndSendPackets( m_hitActors );
|
||||
|
@ -962,3 +966,8 @@ uint64_t Action::Action::getCastTimeRest() const
|
|||
{
|
||||
return m_castTimeRestMs;
|
||||
}
|
||||
|
||||
void Action::Action::enableGenericHandler()
|
||||
{
|
||||
m_enableGenericHandler = true;
|
||||
}
|
|
@ -53,6 +53,8 @@ namespace Sapphire::World::Action
|
|||
|
||||
uint64_t getCastTimeRest() const;
|
||||
|
||||
void enableGenericHandler();
|
||||
|
||||
/*!
|
||||
* @brief Checks if a chara has enough resources available to cast the action (tp/mp/etc)
|
||||
* @return true if they have the required resources
|
||||
|
@ -207,6 +209,7 @@ namespace Sapphire::World::Action
|
|||
bool m_canTargetFriendly{};
|
||||
bool m_canTargetHostile{};
|
||||
bool m_canTargetDead{};
|
||||
bool m_enableGenericHandler{};
|
||||
|
||||
Common::ActionInterruptType m_interruptType;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue