1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-06 02:37:47 +00:00

Removal of more territory move logic

This commit is contained in:
Mordred 2022-01-15 23:28:06 +01:00
parent 79981909de
commit 8767991e7a
4 changed files with 23 additions and 40 deletions

View file

@ -499,27 +499,6 @@ void Sapphire::Entity::Player::setZone( uint32_t zoneId )
} }
} }
bool Sapphire::Entity::Player::setInstance( const TerritoryPtr& instance )
{
m_onEnterEventDone = false;
if( !instance )
return false;
auto& teriMgr = Common::Service< TerritoryMgr >::ref();
// zoning within the same zone won't cause the prev data to be overwritten
if( instance->getTerritoryTypeId() != m_territoryTypeId )
{
auto pZone = teriMgr.getTerritoryByGuId( getTerritoryId() );
m_prevTerritoryTypeId = pZone->getTerritoryTypeId();
m_prevTerritoryId = getTerritoryId();
m_prevPos = m_pos;
m_prevRot = m_rot;
}
return teriMgr.movePlayer( instance, *this );
}
bool Sapphire::Entity::Player::setInstance( const TerritoryPtr& instance, Common::FFXIVARR_POSITION3 pos ) bool Sapphire::Entity::Player::setInstance( const TerritoryPtr& instance, Common::FFXIVARR_POSITION3 pos )
{ {
m_onEnterEventDone = false; m_onEnterEventDone = false;

View file

@ -305,9 +305,6 @@ namespace Sapphire::Entity
/*! sets the players zone, initiating a zoning process */ /*! sets the players zone, initiating a zoning process */
void setZone( uint32_t zoneId ); void setZone( uint32_t zoneId );
/*! sets the players instance & initiates zoning process */
bool setInstance( const TerritoryPtr& instance );
/*! sets the players instance & initiates zoning process */ /*! sets the players instance & initiates zoning process */
bool setInstance( const Sapphire::TerritoryPtr& instance, Sapphire::Common::FFXIVARR_POSITION3 pos ); bool setInstance( const Sapphire::TerritoryPtr& instance, Sapphire::Common::FFXIVARR_POSITION3 pos );

View file

@ -731,7 +731,7 @@ void Sapphire::World::Manager::TerritoryMgr::createAndJoinQuestBattle( Entity::P
if( !qb ) if( !qb )
return; return;
player.setInstance( qb ); player.setInstance( qb, { 0, 0, 0 } );
} }

View file

@ -486,7 +486,7 @@ void Sapphire::Network::GameConnection::gmCommandHandler( const Packets::FFXIVAR
break; break;
} }
player.setInstance( instance ); player.setInstance( instance, { 0, 0, 0 } );
} }
else if( !teriMgr.isValidTerritory( param1 ) ) else if( !teriMgr.isValidTerritory( param1 ) )
{ {
@ -653,23 +653,26 @@ void Sapphire::Network::GameConnection::gmCommandNameHandler( const Packets::FFX
} }
case GmCommand::Jump: case GmCommand::Jump:
{ {
if( pPlayerTerri->getAsInstanceContent() )
{
player.exitInstance();
}
if( targetPlayer->getTerritoryId() != player.getTerritoryId() ) if( targetPlayer->getTerritoryId() != player.getTerritoryId() )
{ {
if( pPlayerTerri->getAsInstanceContent() )
player.exitInstance();
// Checks if the target player is in an InstanceContent to avoid binding to a Territory or PublicContent // Checks if the target player is in an InstanceContent to avoid binding to a Territory or PublicContent
auto pInstanceContent = pTargetActorTerri->getAsInstanceContent(); auto pInstanceContent = pTargetActorTerri->getAsInstanceContent();
if( pInstanceContent ) if( pInstanceContent )
{ {
// Not sure if GMs actually get bound to an instance they jump to on retail. It's mostly here to avoid a crash for now // Not sure if GMs actually get bound to an instance they jump to on retail. It's mostly here to avoid a crash for now
pInstanceContent->bindPlayer( player.getId() ); pInstanceContent->bindPlayer( player.getId() );
player.setInstance( pInstanceContent ); player.setInstance( pInstanceContent, { targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z } );
} }
} }
player.changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z, targetActor->getRot() ); else
player.sendZoneInPackets( 0x00, false ); {
player.changePosition( targetActor->getPos().x, targetActor->getPos().y, targetActor->getPos().z, targetActor->getRot() );
player.sendZoneInPackets( 0x00, false );
}
PlayerMgr::sendServerNotice( player, "Jumping to {0}", targetPlayer->getName() ); PlayerMgr::sendServerNotice( player, "Jumping to {0}", targetPlayer->getName() );
break; break;
} }
@ -681,16 +684,20 @@ void Sapphire::Network::GameConnection::gmCommandNameHandler( const Packets::FFX
PlayerMgr::sendUrgent( player, "You are unable to call a player while bound to a battle instance." ); PlayerMgr::sendUrgent( player, "You are unable to call a player while bound to a battle instance." );
return; return;
} }
if( pTargetActorTerri->getAsInstanceContent() )
{
targetPlayer->exitInstance();
}
if( targetPlayer->getTerritoryId() != player.getTerritoryId() ) if( targetPlayer->getTerritoryId() != player.getTerritoryId() )
{ {
targetPlayer->setInstance( pTargetActorTerri->getAsInstanceContent() ); if( pTargetActorTerri->getAsInstanceContent() )
targetPlayer->exitInstance();
targetPlayer->setInstance( pTargetActorTerri->getAsInstanceContent(), { player.getPos().x, player.getPos().y, player.getPos().z } );
} }
targetPlayer->changePosition( player.getPos().x, player.getPos().y, player.getPos().z, player.getRot() ); else
targetPlayer->sendZoneInPackets( 0x00, false ); {
targetPlayer->changePosition( player.getPos().x, player.getPos().y, player.getPos().z, player.getRot() );
targetPlayer->sendZoneInPackets( 0x00, false );
}
PlayerMgr::sendServerNotice( player, "Calling {0}", targetPlayer->getName() ); PlayerMgr::sendServerNotice( player, "Calling {0}", targetPlayer->getName() );
break; break;
} }