mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-05 10:17:46 +00:00
implement teleportation via aetheryte ticket
This commit is contained in:
parent
989630b2ea
commit
66707a02c2
5 changed files with 12 additions and 7 deletions
|
@ -1790,6 +1790,7 @@ namespace Sapphire::Common
|
||||||
{
|
{
|
||||||
uint16_t targetAetheryte;
|
uint16_t targetAetheryte;
|
||||||
uint16_t cost;
|
uint16_t cost;
|
||||||
|
bool useAetheryteTicket{ false };
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EventSceneError : uint8_t
|
enum EventSceneError : uint8_t
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
auto teleportQuery = pPlayer->getTeleportQuery();
|
auto teleportQuery = pPlayer->getTeleportQuery();
|
||||||
|
|
||||||
if( pPlayer->getCurrency( Common::CurrencyType::Gil ) < teleportQuery.cost ||
|
if( pPlayer->getCurrency( Common::CurrencyType::Gil ) < teleportQuery.cost ||
|
||||||
|
teleportQuery.useAetheryteTicket && !pPlayer->removeItem( 7569 ) ||
|
||||||
teleportQuery.targetAetheryte == 0 )
|
teleportQuery.targetAetheryte == 0 )
|
||||||
{
|
{
|
||||||
action.interrupt();
|
action.interrupt();
|
||||||
|
|
|
@ -1367,7 +1367,7 @@ bool Player::isDirectorInitialized() const
|
||||||
return m_directorInitialized;
|
return m_directorInitialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::teleportQuery( uint16_t aetheryteId )
|
void Player::teleportQuery( uint16_t aetheryteId, bool useAetheryteTicket )
|
||||||
{
|
{
|
||||||
auto& exdData = Common::Service< Data::ExdData >::ref();
|
auto& exdData = Common::Service< Data::ExdData >::ref();
|
||||||
// TODO: only register this action if enough gil is in possession
|
// TODO: only register this action if enough gil is in possession
|
||||||
|
@ -1378,10 +1378,11 @@ void Player::teleportQuery( uint16_t aetheryteId )
|
||||||
|
|
||||||
auto fromAetheryte = exdData.getRow< Excel::Aetheryte >( exdData.getRow< Excel::TerritoryType >( getTerritoryTypeId() )->data().Aetheryte );
|
auto fromAetheryte = exdData.getRow< Excel::Aetheryte >( exdData.getRow< Excel::TerritoryType >( getTerritoryTypeId() )->data().Aetheryte );
|
||||||
|
|
||||||
// calculate cost - does not apply for favorite points or homepoints neither checks for aether tickets
|
// calculate cost - does not apply for favorite points or homepoints
|
||||||
auto cost = static_cast< uint16_t > (
|
// if using aetheryte ticket, cost is 0
|
||||||
|
auto cost = useAetheryteTicket ? 0 : static_cast<uint16_t>(
|
||||||
( std::sqrt( std::pow( fromAetheryte->data().CostPosX - targetAetheryte->data().CostPosX, 2 ) +
|
( std::sqrt( std::pow( fromAetheryte->data().CostPosX - targetAetheryte->data().CostPosX, 2 ) +
|
||||||
std::pow( fromAetheryte->data().CostPosY - targetAetheryte->data().CostPosY, 2 ) ) / 2 ) + 100 );
|
std::pow( fromAetheryte->data().CostPosY - targetAetheryte->data().CostPosY, 2 )) / 2 ) + 100 );
|
||||||
|
|
||||||
// cap at 999 gil
|
// cap at 999 gil
|
||||||
cost = std::min< uint16_t >( 999, cost );
|
cost = std::min< uint16_t >( 999, cost );
|
||||||
|
@ -1393,6 +1394,7 @@ void Player::teleportQuery( uint16_t aetheryteId )
|
||||||
{
|
{
|
||||||
m_teleportQuery.targetAetheryte = aetheryteId;
|
m_teleportQuery.targetAetheryte = aetheryteId;
|
||||||
m_teleportQuery.cost = cost;
|
m_teleportQuery.cost = cost;
|
||||||
|
m_teleportQuery.useAetheryteTicket = useAetheryteTicket;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -339,7 +339,7 @@ namespace Sapphire::Entity
|
||||||
uint64_t getFullOnlineStatusMask() const;
|
uint64_t getFullOnlineStatusMask() const;
|
||||||
|
|
||||||
/*! query teleport of a specified type */
|
/*! query teleport of a specified type */
|
||||||
void teleportQuery( uint16_t aetheryteId );
|
void teleportQuery( uint16_t aetheryteId, bool useAetheryteTicket );
|
||||||
|
|
||||||
Common::PlayerTeleportQuery getTeleportQuery() const;
|
Common::PlayerTeleportQuery getTeleportQuery() const;
|
||||||
|
|
||||||
|
|
|
@ -607,8 +607,9 @@ void Sapphire::Network::GameConnection::commandHandler( const Packets::FFXIVARR_
|
||||||
}
|
}
|
||||||
case PacketCommand::TELEPO_INQUIRY: // Teleport
|
case PacketCommand::TELEPO_INQUIRY: // Teleport
|
||||||
{
|
{
|
||||||
|
// data.Arg0 = aetheryte id
|
||||||
player.teleportQuery( static_cast< uint16_t >( data.Arg0 ) );
|
// data.Arg1 = confirm or cancel if using aetheryte ticket
|
||||||
|
player.teleportQuery( static_cast< uint16_t >( data.Arg0 ), data.Arg1 == 1 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PacketCommand::DYE_ITEM: // Dye item
|
case PacketCommand::DYE_ITEM: // Dye item
|
||||||
|
|
Loading…
Add table
Reference in a new issue