From 01ce52fb1447272ffa2c9311c805f82c2055f388 Mon Sep 17 00:00:00 2001 From: collett Date: Sun, 8 Aug 2021 06:31:59 +0900 Subject: [PATCH] fix the stupid mistake in CFHandler since it exists and actually allows one to join a dungeon, now with your "party members" as well. --- src/world/Network/Handlers/CFHandlers.cpp | 32 ++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/world/Network/Handlers/CFHandlers.cpp b/src/world/Network/Handlers/CFHandlers.cpp index 0cc3a39f..c6e9c36d 100644 --- a/src/world/Network/Handlers/CFHandlers.cpp +++ b/src/world/Network/Handlers/CFHandlers.cpp @@ -76,11 +76,11 @@ void Sapphire::Network::GameConnection::cfRegisterDuty( const Packets::FFXIVARR_ packet->data().cancelReason = 890; queueOutPacket( packet ); - auto cfCondition = exdData.get< Sapphire::Data::ContentFinderCondition >( contentId ); + /*auto cfCondition = exdData.get< Sapphire::Data::ContentFinderCondition >( contentId ); if( !cfCondition ) - return; + return;*/ - auto instance = teriMgr.createInstanceContent( cfCondition->content ); + auto instance = teriMgr.createInstanceContent( /*cfCondition->content*/ contentId ); if( !instance ) return; @@ -89,7 +89,33 @@ void Sapphire::Network::GameConnection::cfRegisterDuty( const Packets::FFXIVARR_ player.sendDebug( "Created instance with id#", instance->getGuId() ); + auto sourceZoneGuId = player.getCurrentTerritory()->getGuId(); player.setInstance( instance ); + + if( player.isPartyLeader() ) + { + player.foreachPartyMember( [ &player, &pInstance, sourceZoneGuId ]( Entity::PlayerPtr m ) + { + if( m->getId() == player.getId() ) + return; + if( m->hasStateFlag( PlayerStateFlag::InNpcEvent ) ) + { + player.sendUrgent( "Cannot teleport {} to the instance, target in event.", m->getName() ); + m->sendUrgent( "Too busy to join instance created by {}.", player.getName() ); + return; + } + if( m->getCurrentTerritory()->getGuId() != sourceZoneGuId ) + { + player.sendUrgent( "Cannot teleport {} to the instance, target in different zone.", m->getName() ); + m->sendUrgent( "Too far to join instance created by {}.", player.getName() ); + return; + } + player.sendUrgent( "Teleporting {} to the instance...", m->getName() ); + m->sendUrgent( "Joining instance created by {}.", player.getName() ); + pInstance->bindPlayer( m->getId() ); + m->setInstance( pInstance ); + } ); + } } void Sapphire::Network::GameConnection::cfRegisterRoulette( const Packets::FFXIVARR_PACKET_RAW& inPacket,