mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-05 18:27:47 +00:00
Add quest event callbacks to yieldeventstring handler
(cherry picked from commit aae05b9f6ecb3af20caa547f58bff2b465957b76)
This commit is contained in:
parent
6580fe1721
commit
5837b1b8b6
1 changed files with 49 additions and 5 deletions
|
@ -354,18 +354,62 @@ void EventMgr::handleReturnStringEventScene( Entity::Player& player, uint32_t ev
|
||||||
result.sceneId = sceneId;
|
result.sceneId = sceneId;
|
||||||
result.resultString = resultString;
|
result.resultString = resultString;
|
||||||
|
|
||||||
auto eventCallback = pEvent->getEventReturnCallback();
|
if( eventType == Event::EventHandler::EventHandlerType::Quest )
|
||||||
if( eventCallback )
|
|
||||||
{
|
{
|
||||||
eventCallback( player, result );
|
auto questId = static_cast< uint16_t >( eventId );
|
||||||
|
auto eventCallback = pEvent->getQuestEventReturnCallback();
|
||||||
|
if( eventCallback )
|
||||||
|
{
|
||||||
|
World::Quest preQ;
|
||||||
|
if( player.hasQuest( eventId ) )
|
||||||
|
{
|
||||||
|
auto questIdx = player.getQuestIndex( questId );
|
||||||
|
auto& quest = player.getQuestByIndex( questIdx );
|
||||||
|
preQ = quest;
|
||||||
|
eventCallback( quest, player, result );
|
||||||
|
if( quest != preQ )
|
||||||
|
player.updateQuest( quest );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto newQuest = World::Quest( questId, 0, 0 );
|
||||||
|
preQ = newQuest;
|
||||||
|
eventCallback( newQuest, player, result );
|
||||||
|
if( newQuest != preQ )
|
||||||
|
player.updateQuest( newQuest );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( auto chainCallback = pEvent->getQuestSceneChainCallback() )
|
||||||
|
{
|
||||||
|
if( player.hasQuest( eventId ) )
|
||||||
|
{
|
||||||
|
auto questIdx = player.getQuestIndex( questId );
|
||||||
|
auto& quest = player.getQuestByIndex( questIdx );
|
||||||
|
chainCallback( quest, player );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto newQuest = World::Quest( questId, 0, 0 );
|
||||||
|
chainCallback( newQuest, player );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto eventCallback = pEvent->getEventReturnCallback();
|
||||||
|
if( eventCallback )
|
||||||
|
{
|
||||||
|
eventCallback( player, result );
|
||||||
|
}
|
||||||
|
|
||||||
// we might have a scene chain callback instead so check for that too
|
// we might have a scene chain callback instead so check for that too
|
||||||
else if( auto chainCallback = pEvent->getSceneChainCallback() )
|
else if( auto chainCallback = pEvent->getSceneChainCallback() )
|
||||||
chainCallback( player );
|
chainCallback( player );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkEvent( player, eventId );
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventMgr::handleReturnIntAndStringEventScene( Entity::Player& player, uint32_t eventId, uint16_t sceneId, const std::string& resultString, uint64_t resultInt )
|
void EventMgr::handleReturnIntAndStringEventScene( Entity::Player& player, uint32_t eventId, uint16_t sceneId, const std::string& resultString, uint64_t resultInt )
|
||||||
|
|
Loading…
Add table
Reference in a new issue