From 37f71da03cae3eec81fd9edfcffda32c630bde5b Mon Sep 17 00:00:00 2001 From: NotAdam Date: Fri, 8 Feb 2019 21:20:53 +1100 Subject: [PATCH] cleanup teleport query code --- src/world/Actor/Player.cpp | 32 ++----------------- src/world/Actor/Player.h | 4 ++- .../Network/Handlers/ClientTriggerHandler.cpp | 2 +- 3 files changed, 7 insertions(+), 31 deletions(-) diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index 6d7d891a..ea2ca233 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -1828,36 +1828,10 @@ void Sapphire::Entity::Player::emoteInterrupt() sendToInRangeSet( makeActorControl142( getId(), ActorControlType::EmoteInterrupt ) ); } -void Sapphire::Entity::Player::teleportQuery( uint16_t aetheryteId, FrameworkPtr pFw ) +void Sapphire::Entity::Player::teleportQuery( uint16_t aetheryteId ) { -// auto pExdData = pFw->get< Data::ExdDataGenerated >(); -// // TODO: only register this action if enough gil is in possession -// auto targetAetheryte = pExdData->get< Sapphire::Data::Aetheryte >( aetheryteId ); -// -// if( targetAetheryte ) -// { -// auto fromAetheryte = pExdData->get< Sapphire::Data::Aetheryte >( -// pExdData->get< Sapphire::Data::TerritoryType >( getZoneId() )->aetheryte ); -// -// // calculate cost - does not apply for favorite points or homepoints neither checks for aether tickets -// auto cost = static_cast< uint16_t > ( -// ( std::sqrt( std::pow( fromAetheryte->aetherstreamX - targetAetheryte->aetherstreamX, 2 ) + -// std::pow( fromAetheryte->aetherstreamY - targetAetheryte->aetherstreamY, 2 ) ) / 2 ) + 100 ); -// -// // cap at 999 gil -// cost = cost > uint16_t{ 999 } ? uint16_t{ 999 } : cost; -// -// bool insufficientGil = getCurrency( Common::CurrencyType::Gil ) < cost; -// // TODO: figure out what param1 really does -// queuePacket( makeActorControl143( getId(), TeleportStart, insufficientGil ? 2 : 0, aetheryteId ) ); -// -// if( !insufficientGil ) -// { -// Action::ActionPtr pActionTeleport; -// pActionTeleport = Action::make_ActionTeleport( getAsPlayer(), aetheryteId, cost, pFw ); -// setCurrentAction( pActionTeleport ); -// } -// } + m_teleportTargetAetheryte = aetheryteId; + sendDebug( "requested aetheryte destination: {0}", aetheryteId ); } uint8_t Sapphire::Entity::Player::getNextObjSpawnIndexForActorId( uint32_t actorId ) diff --git a/src/world/Actor/Player.h b/src/world/Actor/Player.h index 154b4fe2..9633b7a7 100644 --- a/src/world/Actor/Player.h +++ b/src/world/Actor/Player.h @@ -531,7 +531,7 @@ namespace Sapphire::Entity void teleport( uint16_t aetheryteId, uint8_t type = 1 ); /*! query teleport of a specified type */ - void teleportQuery( uint16_t aetheryteId, FrameworkPtr pFw ); + void teleportQuery( uint16_t aetheryteId ); /*! prepares zoning / fades out the screen */ void prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadeOutTime = 0, uint16_t animation = 0 ); @@ -1086,6 +1086,8 @@ namespace Sapphire::Entity uint32_t m_mount; uint32_t m_emoteMode; + uint16_t m_teleportTargetAetheryte; + Util::SpawnIndexAllocator< uint8_t > m_objSpawnIndexAllocator; Util::SpawnIndexAllocator< uint8_t > m_actorSpawnIndexAllocator; }; diff --git a/src/world/Network/Handlers/ClientTriggerHandler.cpp b/src/world/Network/Handlers/ClientTriggerHandler.cpp index 899c062b..6aad2f8c 100644 --- a/src/world/Network/Handlers/ClientTriggerHandler.cpp +++ b/src/world/Network/Handlers/ClientTriggerHandler.cpp @@ -274,7 +274,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw, case ClientTriggerType::Teleport: // Teleport { - player.teleportQuery( param11, pFw ); + player.teleportQuery( param11 ); break; } case ClientTriggerType::DyeItem: // Dye item