mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-04 09:47:46 +00:00
Implement FcTalk
This commit is contained in:
parent
5771795402
commit
964716d2ee
2 changed files with 61 additions and 0 deletions
56
src/scripts/common/FcTalk.cpp
Normal file
56
src/scripts/common/FcTalk.cpp
Normal file
|
@ -0,0 +1,56 @@
|
|||
#include <ScriptObject.h>
|
||||
#include <Actor/Player.h>
|
||||
|
||||
#include <Exd/ExdData.h>
|
||||
|
||||
using namespace Sapphire;
|
||||
|
||||
class FcTalk :
|
||||
public Sapphire::ScriptAPI::EventScript
|
||||
{
|
||||
public:
|
||||
FcTalk() :
|
||||
Sapphire::ScriptAPI::EventScript( 0x001F0000 )
|
||||
{
|
||||
}
|
||||
|
||||
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
||||
{
|
||||
auto& exdData = Common::Service< Data::ExdData >::ref();
|
||||
auto switchTalk = exdData.getRow< Excel::SwitchTalk >( eventId );
|
||||
uint32_t talkEvent = 0;
|
||||
|
||||
if( !switchTalk )
|
||||
return;
|
||||
|
||||
for( auto entry = 15; entry >= 0; entry-- )
|
||||
{
|
||||
auto caseCondition = switchTalk->data().TalkCase[ entry ].CaseCondition;
|
||||
|
||||
if( ( caseCondition >> 16 ) == Event::EventHandler::EventHandlerType::Quest && player.isQuestCompleted( caseCondition ) )
|
||||
{
|
||||
talkEvent = switchTalk->data().TalkCase[ entry ].Talk;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
talkEvent = switchTalk->data().TalkCase[ 0 ].Talk;
|
||||
}
|
||||
}
|
||||
|
||||
if( talkEvent == 0 )
|
||||
return;
|
||||
|
||||
eventMgr().eventStart( player, actorId, eventId, Event::EventHandler::EventType::Talk, 0, 0 );
|
||||
eventMgr().eventStart( player, actorId, talkEvent, Event::EventHandler::EventType::Nest, 0, 5 );
|
||||
|
||||
eventMgr().playScene( player, talkEvent, 0, HIDE_HOTBAR | NO_DEFAULT_CAMERA, { 0 },
|
||||
[ & ]( Entity::Player& player, const Event::SceneResult& result )
|
||||
{
|
||||
eventMgr().eventFinish( player, talkEvent, 1 );
|
||||
eventMgr().eventFinish( player, eventId, 1 );
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
EXPOSE_SCRIPT( FcTalk );
|
|
@ -136,6 +136,11 @@ std::string EventMgr::getEventName( uint32_t eventId )
|
|||
}*/
|
||||
//return unknown + "GilShop";
|
||||
}
|
||||
|
||||
case Event::EventHandler::EventHandlerType::FcTalk:
|
||||
{
|
||||
return "FcTalk";
|
||||
}
|
||||
default:
|
||||
{
|
||||
return unknown;
|
||||
|
|
Loading…
Add table
Reference in a new issue