2018-06-18 13:14:11 +00:00
|
|
|
#include <ScriptObject.h>
|
2018-03-07 08:14:42 +01:00
|
|
|
#include <Actor/Player.h>
|
|
|
|
|
|
|
|
#define ACTION_CREATE 2
|
|
|
|
#define ACTION_RENAME 3
|
|
|
|
#define ACTION_REMOVE 4
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
using namespace Sapphire;
|
2018-10-28 21:53:21 +01:00
|
|
|
|
2018-08-29 21:40:59 +02:00
|
|
|
class CmnDefLinkShell :
|
2018-11-13 21:34:44 +11:00
|
|
|
public Sapphire::ScriptAPI::EventScript
|
2018-03-07 08:14:42 +01:00
|
|
|
{
|
|
|
|
public:
|
2018-08-29 21:40:59 +02:00
|
|
|
CmnDefLinkShell() :
|
2018-11-13 21:34:44 +11:00
|
|
|
Sapphire::ScriptAPI::EventScript( 0xB0006 )
|
2018-08-29 21:40:59 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Scene00001( Entity::Player& player )
|
|
|
|
{
|
|
|
|
auto callback = [ this ]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
switch( result.getResult( 0 ) )
|
2018-03-07 08:14:42 +01:00
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
case ACTION_CREATE:
|
|
|
|
Scene00002( player );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACTION_RENAME:
|
|
|
|
Scene00003( player );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACTION_REMOVE:
|
|
|
|
Scene00004( player );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-12-03 22:21:18 +01:00
|
|
|
eventMgr().playScene( player, getId(), 1, HIDE_HOTBAR | NO_DEFAULT_CAMERA, callback );
|
2018-08-29 21:40:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// create linkshell
|
|
|
|
void Scene00002( Entity::Player& player )
|
|
|
|
{
|
2021-12-02 22:58:36 +01:00
|
|
|
auto callback = [ this ]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
2021-12-02 23:27:27 +01:00
|
|
|
auto ls = linkshellMgr().createLinkshell( result.resultString, player );
|
|
|
|
if( !ls )
|
2021-12-03 22:21:18 +01:00
|
|
|
{
|
2021-12-09 22:10:14 +01:00
|
|
|
eventMgr().resumeScene( player, result.eventId, result.sceneId, { 0x15a }, false );
|
2021-12-12 23:26:12 +01:00
|
|
|
linkshellMgr().finishLinkshellAction( result.resultString, 0x15a, player, 1 );
|
2021-12-03 22:21:18 +01:00
|
|
|
}
|
2021-12-02 23:27:27 +01:00
|
|
|
else
|
2021-12-03 22:21:18 +01:00
|
|
|
{
|
2021-12-09 22:10:14 +01:00
|
|
|
eventMgr().resumeScene( player, result.eventId, result.sceneId, { 0 }, true );
|
2021-12-12 23:26:12 +01:00
|
|
|
linkshellMgr().finishLinkshellAction( result.resultString, 0, player, 1 );
|
2021-12-03 22:21:18 +01:00
|
|
|
}
|
|
|
|
|
2021-12-02 22:58:36 +01:00
|
|
|
};
|
|
|
|
|
2021-12-03 22:21:18 +01:00
|
|
|
eventMgr().playScene( player, getId(), 2, HIDE_HOTBAR, callback );
|
2018-08-29 21:40:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// rename linkshell
|
|
|
|
void Scene00003( Entity::Player& player )
|
|
|
|
{
|
2021-12-12 23:26:12 +01:00
|
|
|
auto callback = [ this ]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
|
|
|
auto ls = linkshellMgr().renameLinkshell( result.intResult, result.resultString, player );
|
|
|
|
if( !ls )
|
|
|
|
{
|
|
|
|
eventMgr().resumeScene( player, result.eventId, result.sceneId, { 0x15a }, false );
|
|
|
|
linkshellMgr().finishLinkshellAction( result.resultString, 0x15a, player, 3 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
eventMgr().resumeScene( player, result.eventId, result.sceneId, { 0 }, true );
|
|
|
|
linkshellMgr().finishLinkshellAction( result.resultString, 0, player, 3 );
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
eventMgr().playScene( player, getId(), 3, HIDE_HOTBAR, callback );
|
2018-08-29 21:40:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// remove linkshell
|
|
|
|
void Scene00004( Entity::Player& player )
|
|
|
|
{
|
2021-12-03 22:21:18 +01:00
|
|
|
eventMgr().playScene( player, getId(), 4, HIDE_HOTBAR );
|
2018-08-29 21:40:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
|
|
|
{
|
|
|
|
Scene00001( player );
|
|
|
|
}
|
2019-02-20 17:38:03 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
EXPOSE_SCRIPT( CmnDefLinkShell );
|