2019-03-07 21:58:12 +11:00
|
|
|
#include <Script/NativeScriptApi.h>
|
|
|
|
#include <ScriptObject.h>
|
|
|
|
#include <Actor/Player.h>
|
|
|
|
#include <Action/Action.h>
|
|
|
|
|
|
|
|
using namespace Sapphire;
|
|
|
|
|
|
|
|
class ActionTeleport5 :
|
|
|
|
public Sapphire::ScriptAPI::ActionScript
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ActionTeleport5() :
|
|
|
|
Sapphire::ScriptAPI::ActionScript( 5 )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void onExecute( Sapphire::Action::Action& action ) override
|
|
|
|
{
|
|
|
|
auto player = action.getSourceChara()->getAsPlayer();
|
|
|
|
|
|
|
|
if( !player )
|
|
|
|
return;
|
|
|
|
|
|
|
|
auto teleportQuery = player->getTeleportQuery();
|
|
|
|
|
2019-03-07 22:24:42 +11:00
|
|
|
if( player->getCurrency( Common::CurrencyType::Gil ) < teleportQuery.cost ||
|
|
|
|
teleportQuery.targetAetheryte == 0 )
|
2019-03-07 21:58:12 +11:00
|
|
|
{
|
|
|
|
action.interrupt();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
player->removeCurrency( Common::CurrencyType::Gil, teleportQuery.cost );
|
|
|
|
|
|
|
|
player->setZoningType( Common::ZoneingType::Teleport );
|
2019-03-07 22:24:42 +11:00
|
|
|
player->teleport( teleportQuery.targetAetheryte );
|
2019-03-07 21:58:12 +11:00
|
|
|
|
|
|
|
player->clearTeleportQuery();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
EXPOSE_SCRIPT( ActionTeleport5 );
|