mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-30 08:07:46 +00:00
Simplified EventReturnHandler
This commit is contained in:
parent
52f341c906
commit
9d07048f0d
1 changed files with 10 additions and 26 deletions
|
@ -216,8 +216,6 @@ bool Core::Scripting::ScriptManager::onEventHandlerReturn( Entity::Player& playe
|
||||||
" p2: " + std::to_string( param2 ) +
|
" p2: " + std::to_string( param2 ) +
|
||||||
" p3: " + std::to_string( param3 ) );
|
" p3: " + std::to_string( param3 ) );
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
auto pEvent = player.getEvent( eventId );
|
auto pEvent = player.getEvent( eventId );
|
||||||
if( pEvent )
|
if( pEvent )
|
||||||
{
|
{
|
||||||
|
@ -226,22 +224,9 @@ bool Core::Scripting::ScriptManager::onEventHandlerReturn( Entity::Player& playe
|
||||||
auto eventCallback = pEvent->getEventReturnCallback();
|
auto eventCallback = pEvent->getEventReturnCallback();
|
||||||
// if there is one, proceed to call it
|
// if there is one, proceed to call it
|
||||||
if( eventCallback )
|
if( eventCallback )
|
||||||
{
|
|
||||||
eventCallback( player, eventId, param1, param2, param3 );
|
eventCallback( player, eventId, param1, param2, param3 );
|
||||||
if( !pEvent->hasPlayedScene() )
|
// check the event, finishing it if needed
|
||||||
player.eventFinish( eventId, 1 );
|
player.checkEvent( eventId );
|
||||||
else
|
|
||||||
pEvent->setPlayedScene( false );
|
|
||||||
}
|
|
||||||
// else, finish the event.
|
|
||||||
else
|
|
||||||
player.eventFinish( eventId, 1 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch( std::exception& e )
|
|
||||||
{
|
|
||||||
player.sendNotice( e.what() );
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -254,7 +239,6 @@ bool Core::Scripting::ScriptManager::onEventHandlerTradeReturn( Entity::Player&
|
||||||
if( script )
|
if( script )
|
||||||
{
|
{
|
||||||
script->onEventHandlerTradeReturn( player, eventId, subEvent, param, catalogId );
|
script->onEventHandlerTradeReturn( player, eventId, subEvent, param, catalogId );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue