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"
|
2022-02-10 18:50:44 +01:00
|
|
|
#include "Territory/Territory.h"
|
2019-10-28 22:18:23 +01:00
|
|
|
|
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() :
|
2022-02-10 18:50:44 +01:00
|
|
|
Sapphire::ScriptAPI::EventScript( 0x00020000 )
|
2018-11-19 23:52:35 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override
|
|
|
|
{
|
2022-02-10 18:50:44 +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;
|
|
|
|
|
2022-02-10 18:50:44 +01:00
|
|
|
auto qualifiedPreResult = [ this ]( Entity::Player& player, const Event::SceneResult& result )
|
|
|
|
{
|
|
|
|
//eventMgr().playScene( player, result.eventId, 1, HIDE_HOTBAR, { 1 }, nullptr );
|
|
|
|
if( result.getResult( 0 ) == 1 && result.errorCode != Common::EventSceneError::EVENT_SCENE_ERROR_LUA_ERRRUN )
|
|
|
|
{
|
|
|
|
auto warp = this->exdData().getRow< Excel::Warp >( result.eventId );
|
|
|
|
if( warp )
|
|
|
|
{
|
|
|
|
auto popRangeInfo = instanceObjectCache().getPopRangeInfo( warp->data().PopRange );
|
|
|
|
if( popRangeInfo )
|
|
|
|
{
|
|
|
|
auto pTeri = teriMgr().getZoneByTerritoryTypeId( popRangeInfo->m_territoryTypeId );
|
|
|
|
warpMgr().requestMoveTerritory( player, Sapphire::Common::WARP_TYPE_TOWN_TRANSLATE,
|
|
|
|
pTeri->getGuId(), popRangeInfo->m_pos, popRangeInfo->m_rotation );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
eventMgr().playScene( player, eventId, 0, HIDE_HOTBAR, { 1 }, qualifiedPreResult );
|
2018-11-19 23:52:35 +01:00
|
|
|
}
|
2019-02-20 17:38:03 +11:00
|
|
|
};
|
|
|
|
|
|
|
|
EXPOSE_SCRIPT( WarpTaxi );
|