diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index 476003c0..bcbbd11a 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -1563,6 +1563,11 @@ struct FFXIVIpcDirectorVars : FFXIVIpcBasePacket< DirectorVars > uint8_t m_branch; /*! raw storage for flags/vars */ uint8_t m_unionData[10]; + /*! unknown */ + uint16_t u20; + uint16_t u22; + uint16_t u24; + uint16_t u28; }; diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index 17d7850e..5c0ac513 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -11,11 +11,12 @@ #include "Session.h" #include "Player.h" +#include "Manager/HousingMgr.h" #include "Manager/TerritoryMgr.h" + #include "Territory/Zone.h" #include "Territory/ZonePosition.h" - -#include "Manager/HousingMgr.h" +#include "Territory/InstanceContent.h" #include "Territory/Land.h" #include "Network/GameConnection.h" @@ -491,6 +492,9 @@ bool Sapphire::Entity::Player::exitInstance() { auto pTeriMgr = m_pFw->get< TerritoryMgr >(); + auto pZone = getCurrentZone(); + auto pInstance = pZone->getAsInstanceContent(); + // check if housing zone if( pTeriMgr->isHousingTerritory( m_prevTerritoryTypeId ) ) { @@ -510,6 +514,8 @@ bool Sapphire::Entity::Player::exitInstance() sendZonePackets(); + //m_queuedZoneing = std::make_shared< QueuedZoning >( m_territoryTypeId, m_pos, Util::getTimeMs(), m_rot ); + return true; } diff --git a/src/world/Manager/DebugCommandMgr.cpp b/src/world/Manager/DebugCommandMgr.cpp index 6c4752ba..4d234541 100644 --- a/src/world/Manager/DebugCommandMgr.cpp +++ b/src/world/Manager/DebugCommandMgr.cpp @@ -794,14 +794,14 @@ Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Player& if( subCommand == "create" || subCommand == "cr" ) { - uint32_t instanceContentId; - sscanf( params.c_str(), "%d", &instanceContentId ); + uint32_t contentFinderConditionId; + sscanf( params.c_str(), "%d", &contentFinderConditionId ); - auto instance = pTeriMgr->createInstanceContent( instanceContentId ); + auto instance = pTeriMgr->createInstanceContent( contentFinderConditionId ); if( instance ) player.sendDebug( "Created instance with id#{0} -> {1}", instance->getGuId(), instance->getName() ); else - player.sendDebug( "Failed to create instance with id#{0}", instanceContentId ); + player.sendDebug( "Failed to create instance with id#{0}", contentFinderConditionId ); } else if( subCommand == "bind" ) { diff --git a/src/world/Manager/TerritoryMgr.cpp b/src/world/Manager/TerritoryMgr.cpp index 9c3da5d0..56e3a049 100644 --- a/src/world/Manager/TerritoryMgr.cpp +++ b/src/world/Manager/TerritoryMgr.cpp @@ -535,8 +535,8 @@ bool Sapphire::World::Manager::TerritoryMgr::movePlayer( ZonePtr pZone, Sapphire // mark character as zoning in progress pPlayer->setLoadingComplete( false ); - //if( pPlayer->getLastPing() != 0 ) - // pPlayer->getCurrentZone()->removeActor( pPlayer ); + if( pPlayer->getLastPing() != 0 ) + pPlayer->getCurrentZone()->removeActor( pPlayer ); pPlayer->setCurrentZone( pZone ); pZone->pushActor( pPlayer ); diff --git a/src/world/Network/Handlers/ClientTriggerHandler.cpp b/src/world/Network/Handlers/ClientTriggerHandler.cpp index 8b519de1..362e6a13 100644 --- a/src/world/Network/Handlers/ClientTriggerHandler.cpp +++ b/src/world/Network/Handlers/ClientTriggerHandler.cpp @@ -294,7 +294,7 @@ void Sapphire::Network::GameConnection::clientTriggerHandler( FrameworkPtr pFw, } case ClientTriggerType::RequestInstanceLeave: { - // todo: apply cf penalty if applicable, make sure player isnt in combat + // todo: apply cf penalty if applicable, make sure player isn't in combat player.exitInstance(); break; } diff --git a/src/world/Territory/InstanceContent.cpp b/src/world/Territory/InstanceContent.cpp index 6c9a2db6..99d604ec 100644 --- a/src/world/Territory/InstanceContent.cpp +++ b/src/world/Territory/InstanceContent.cpp @@ -89,11 +89,8 @@ void Sapphire::InstanceContent::onLeaveTerritory( Entity::Player& player ) { Logger::debug( "InstanceContent::onLeaveTerritory: Zone#{0}|{1}, Entity#{2}", getGuId(), getTerritoryTypeId(), player.getId() ); - sendDirectorClear( player ); - player.setDirectorInitialized( false ); - // remove "bound by duty" state - player.unsetStateFlag( PlayerStateFlag::BoundByDuty ); + clearDirector( player ); } void Sapphire::InstanceContent::onUpdate( uint32_t currTime ) @@ -450,3 +447,11 @@ void Sapphire::InstanceContent::unbindPlayer( uint32_t playerId ) if( it != m_playerMap.end() ) it->second->exitInstance(); } + +void Sapphire::InstanceContent::clearDirector( Entity::Player& player ) +{ + sendDirectorClear( player ); + + player.setDirectorInitialized( false ); + // remove "bound by duty" state + player.unsetStateFlag( PlayerStateFlag::BoundByDuty );} diff --git a/src/world/Territory/InstanceContent.h b/src/world/Territory/InstanceContent.h index 11b6e0dc..85a34ebc 100644 --- a/src/world/Territory/InstanceContent.h +++ b/src/world/Territory/InstanceContent.h @@ -64,6 +64,8 @@ public: void endEventCutscene(); + void clearDirector( Entity::Player& player ); + /*! set the current bgm index (inside bgm.exd) */ void setCurrentBGM( uint16_t bgmId );