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"
|
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
#include <Exd/ExdData.h>
|
2018-11-22 01:17:19 +11:00
|
|
|
#include <Manager/PlayerMgr.h>
|
2020-03-01 01:00:57 +11:00
|
|
|
#include <Service.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 )
|
|
|
|
{
|
2022-01-16 11:57:04 +01:00
|
|
|
/* if( result.numOfResults == 1 ) // exit
|
2018-11-19 23:52:35 +01:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().eventFinish( player, 1310721, 0 );
|
|
|
|
eventMgr().eventFinish( player, getId(), 1 );
|
2018-11-20 22:52:57 +11:00
|
|
|
}
|
2021-11-27 00:53:57 +01:00
|
|
|
else if( result.numOfResults == 2 ) // teleport to ward
|
2018-11-20 22:52:57 +11:00
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().eventFinish( player, 1310721, 0 );
|
|
|
|
eventMgr().eventFinish( player, getId(), 1 );
|
2018-11-20 22:52:57 +11:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
auto& exdData = Common::Service< Data::ExdData >::ref();
|
2020-03-01 01:00:57 +11:00
|
|
|
auto& popRange = Common::Service< Sapphire::InstanceObjectCache >::ref();
|
2019-10-28 22:18:23 +01:00
|
|
|
|
2022-01-27 21:24:54 +01:00
|
|
|
auto warp = exdData.getRow< Excel::Warp >( getId() );
|
2018-11-20 22:52:57 +11:00
|
|
|
if( !warp )
|
|
|
|
return;
|
|
|
|
|
2020-03-01 01:00:57 +11:00
|
|
|
auto& playerMgr = Common::Service< Sapphire::World::Manager::PlayerMgr >::ref();
|
2019-10-28 22:18:23 +01:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
// EXD TODO: This was TerritoryType from warp before...
|
|
|
|
auto pPop = popRange.getPopRange( player.getTerritoryTypeId(), warp->data().PopRange );
|
2019-10-28 22:18:23 +01:00
|
|
|
|
|
|
|
if( !pPop )
|
|
|
|
{
|
|
|
|
std::cout << "not found...";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::cout << "found!!";
|
|
|
|
}
|
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
playerMgr.movePlayerToLandDestination( player, warp->data().PopRange, result.getResult( 1 ) );
|
2018-11-20 22:52:57 +11:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().playScene( player, 1310721, 0, HIDE_HOTBAR, { 1, 341 },
|
|
|
|
std::bind( &WarpTaxi::inner, this, std::placeholders::_1, std::placeholders::_2 ) );
|
2022-01-16 11:57:04 +01:00
|
|
|
}*/
|
2018-11-19 23:52:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void inner2( Entity::Player& player, uint64_t actorId )
|
|
|
|
{
|
2022-01-16 11:57:04 +01:00
|
|
|
/* eventMgr().playScene( player, getId(), 0, HIDE_HOTBAR, { 32529 },
|
2019-03-17 22:25:52 +01:00
|
|
|
[this, actorId]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().eventStart( player, actorId, 1310721, Event::EventHandler::Nest, 1, 0 );
|
2018-11-20 22:52:57 +11:00
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
eventMgr().playScene( player, 1310721, 0, HIDE_HOTBAR, { 1, 341 },
|
|
|
|
std::bind( &WarpTaxi::inner, this, std::placeholders::_1, std::placeholders::_2 ) );
|
2022-01-16 11:57:04 +01:00
|
|
|
} );*/
|
2018-11-19 23:52:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
|
|
|
{
|
2022-01-16 11:57:04 +01:00
|
|
|
/* auto& exdData = Common::Service< Sapphire::Data::ExdData >::ref();
|
2018-11-19 23:52:35 +01:00
|
|
|
|
2022-01-27 21:24:54 +01:00
|
|
|
auto warp = exdData.getRow< Excel::Warp >( eventId );
|
2018-11-19 23:52:35 +01:00
|
|
|
if( !warp )
|
|
|
|
return;
|
|
|
|
|
2021-11-27 00:53:57 +01:00
|
|
|
// EXD TODO: Not sure Warpcondition is correct here
|
|
|
|
eventMgr().eventStart( player, actorId, warp->data().WarpCondition, Event::EventHandler::Nest, 0, 0,
|
|
|
|
std::bind( &WarpTaxi::inner2, this, std::placeholders::_1, std::placeholders::_2 ) );
|
2022-01-16 11:57:04 +01:00
|
|
|
eventMgr().playScene( player, warp->data().WarpCondition, 0, HIDE_HOTBAR, { 7 }, nullptr );*/
|
2018-11-19 23:52:35 +01:00
|
|
|
}
|
2019-02-20 17:38:03 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
EXPOSE_SCRIPT( WarpTaxi );
|