2018-11-19 23:52:35 +01:00
|
|
|
#include <ScriptObject.h>
|
|
|
|
#include <Actor/Player.h>
|
|
|
|
|
2019-10-28 22:18:23 +01:00
|
|
|
#include <datReader/DatCategories/bg/LgbTypes.h>
|
2020-01-06 20:19:42 +11:00
|
|
|
#include <datReader/DatCategories/bg/lgb.h>
|
2019-10-28 22:18:23 +01:00
|
|
|
|
|
|
|
#include "Territory/InstanceObjectCache.h"
|
|
|
|
|
2018-11-19 23:52:35 +01:00
|
|
|
#include <Exd/ExdDataGenerated.h>
|
|
|
|
#include <Framework.h>
|
2018-11-22 01:17:19 +11:00
|
|
|
#include <Manager/PlayerMgr.h>
|
2018-11-19 23:52:35 +01:00
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
using namespace Sapphire;
|
2018-11-19 23:52:35 +01:00
|
|
|
|
|
|
|
class WarpTaxi : public Sapphire::ScriptAPI::EventScript
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WarpTaxi() :
|
|
|
|
Sapphire::ScriptAPI::EventScript( 0x0002005a )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void inner( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
2018-11-20 22:52:57 +11:00
|
|
|
if( result.param1 == 256 ) // exit
|
2018-11-19 23:52:35 +01:00
|
|
|
{
|
2018-11-20 22:52:57 +11:00
|
|
|
player.eventFinish( 1310721, 0 );
|
|
|
|
player.eventFinish( getId(), 1 );
|
|
|
|
}
|
|
|
|
else if( result.param1 == 768 ) // teleport to ward
|
|
|
|
{
|
|
|
|
player.eventFinish( 1310721, 0 );
|
|
|
|
player.eventFinish( getId(), 1 );
|
|
|
|
|
2019-03-23 16:57:00 +11:00
|
|
|
auto exdData = framework()->get< Sapphire::Data::ExdDataGenerated >();
|
2019-10-28 22:18:23 +01:00
|
|
|
auto pPopRange = framework()->get< Sapphire::InstanceObjectCache >();
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
auto warp = exdData->get< Sapphire::Data::Warp >( getId() );
|
2018-11-20 22:52:57 +11:00
|
|
|
if( !warp )
|
|
|
|
return;
|
|
|
|
|
2019-03-23 16:57:00 +11:00
|
|
|
auto playerMgr = framework()->get< Sapphire::World::Manager::PlayerMgr >();
|
2019-10-28 22:18:23 +01:00
|
|
|
|
2020-02-24 23:04:25 +11:00
|
|
|
auto pPop = pPopRange->getPopRange( warp->territoryType, warp->popRange );
|
2019-10-28 22:18:23 +01:00
|
|
|
|
|
|
|
if( !pPop )
|
|
|
|
{
|
|
|
|
std::cout << "not found...";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::cout << "found!!";
|
|
|
|
}
|
|
|
|
|
2020-02-24 23:04:25 +11:00
|
|
|
playerMgr->movePlayerToLandDestination( player, warp->popRange, result.param3 );
|
2018-11-20 22:52:57 +11:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-03-17 22:25:52 +01:00
|
|
|
player.playScene( 1310721, 0, HIDE_HOTBAR, 0, 1, 341,
|
|
|
|
std::bind( &WarpTaxi::inner, this, std::placeholders::_1, std::placeholders::_2 ) );
|
2018-11-19 23:52:35 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void inner2( Entity::Player& player, uint64_t actorId )
|
|
|
|
{
|
2019-03-17 22:25:52 +01:00
|
|
|
player.playScene( getId(), 0, HIDE_HOTBAR, 0, 0, 32529,
|
|
|
|
[this, actorId]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
|
|
|
player.eventStart( actorId, 1310721, Event::EventHandler::Nest, 1, 0 );
|
2018-11-20 22:52:57 +11:00
|
|
|
|
2019-03-17 22:25:52 +01:00
|
|
|
player.playScene( 1310721, 0, HIDE_HOTBAR, 0, 1, 341,
|
|
|
|
std::bind( &WarpTaxi::inner, this, std::placeholders::_1, std::placeholders::_2 ) );
|
|
|
|
} );
|
2018-11-19 23:52:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
|
|
|
{
|
2019-03-23 16:57:00 +11:00
|
|
|
auto exdData = framework()->get< Sapphire::Data::ExdDataGenerated >();
|
2018-11-20 22:52:57 +11:00
|
|
|
if( !exdData )
|
2018-11-19 23:52:35 +01:00
|
|
|
return;
|
|
|
|
|
2018-11-29 16:55:48 +01:00
|
|
|
auto warp = exdData->get< Sapphire::Data::Warp >( eventId );
|
2018-11-19 23:52:35 +01:00
|
|
|
if( !warp )
|
|
|
|
return;
|
|
|
|
|
2018-11-23 21:16:02 +01:00
|
|
|
player.eventStart( actorId, warp->conditionSuccessEvent, Event::EventHandler::Nest, 0, 0,
|
|
|
|
std::bind( &WarpTaxi::inner2, this, std::placeholders::_1, std::placeholders::_2 ) );
|
|
|
|
player.playScene( warp->conditionSuccessEvent, 0, HIDE_HOTBAR, 0, 0, 7, nullptr );
|
2018-11-19 23:52:35 +01:00
|
|
|
}
|
2019-02-20 17:38:03 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
EXPOSE_SCRIPT( WarpTaxi );
|