diff --git a/src/common/Network/CommonActorControl.h b/src/common/Network/CommonActorControl.h index b2f14640..5128f4e8 100644 --- a/src/common/Network/CommonActorControl.h +++ b/src/common/Network/CommonActorControl.h @@ -117,7 +117,8 @@ namespace Sapphire::Network::ActorControl TeleportDone = 0xCD, TeleportDoneFadeOut = 0xCE, - DespawnZoneScreenMsg = 0xCF, + + WarpStart = 0xCF, InstanceSelectDlg = 0xD2, ActorDespawnEffect = 0xD4, diff --git a/src/common/Network/PacketDef/Zone/ServerZoneDef.h b/src/common/Network/PacketDef/Zone/ServerZoneDef.h index 00664937..0047e6c4 100644 --- a/src/common/Network/PacketDef/Zone/ServerZoneDef.h +++ b/src/common/Network/PacketDef/Zone/ServerZoneDef.h @@ -12,14 +12,22 @@ namespace Sapphire::Network::Packets::WorldPackets::Server { + struct ZoneProtoDownServerPos + { + uint32_t originEntityId; + float pos[3]; + float dir; + }; + /** * Structural representation of the packet sent by the server as response * to a ping packet */ struct FFXIVIpcSync : FFXIVIpcBasePacket< SyncReply > { - /* 0000 */ uint64_t timeInMilliseconds; - /* 0008 */ uint8_t unknown_8[0x38]; + uint32_t clientTimeValue; + uint32_t transmissionInterval; + ZoneProtoDownServerPos position; }; /** @@ -1643,6 +1651,19 @@ namespace Sapphire::Network::Packets::WorldPackets::Server /* 0004 */ uint32_t mapId; }; + struct FFXIVIpcMoveTerritory : FFXIVIpcBasePacket< MoveTerritory > + { + int16_t index; + uint8_t territoryType; + uint8_t zoneId; + uint16_t worldId; + uint16_t worldId1; + int64_t landSetId; + int64_t landId; + int64_t landTerritoryId; + char worldName[32]; + }; + /** * */ diff --git a/src/world/Action/EffectBuilder.cpp b/src/world/Action/EffectBuilder.cpp index c3593123..b5f250c8 100644 --- a/src/world/Action/EffectBuilder.cpp +++ b/src/world/Action/EffectBuilder.cpp @@ -179,7 +179,7 @@ std::shared_ptr< FFXIVPacketBase > EffectBuilder::buildNextEffectPacket( uint32_ for( int i = 0; i < resultList->size(); i++ ) { auto result = resultList->data()[ i ]; - effectPacket->addTargetEffect( result->buildEffectEntry(), static_cast< uint64_t >( firstResult->getTarget()->getId() ) ); + effectPacket->addTargetEffect( result->buildEffectEntry() ); m_sourceChara->getCurrentTerritory()->addEffectResult( std::move( result ) ); } diff --git a/src/world/Actor/BNpc.cpp b/src/world/Actor/BNpc.cpp index f4401d89..21efd503 100644 --- a/src/world/Actor/BNpc.cpp +++ b/src/world/Actor/BNpc.cpp @@ -335,7 +335,7 @@ void Sapphire::Entity::BNpc::despawn( PlayerPtr pTarget ) auto& server = Common::Service< World::WorldServer >::ref(); - server.queueForPlayer( pTarget->getCharacterId(), makeActorControlSelf( m_id, DespawnZoneScreenMsg, 0x04, getId(), 0x01 ) ); + server.queueForPlayer( pTarget->getCharacterId(), makeActorControlSelf( m_id, WarpStart, 0x04, getId(), 0x01 ) ); } Sapphire::Entity::BNpcState Sapphire::Entity::BNpc::getState() const @@ -919,7 +919,7 @@ void Sapphire::Entity::BNpc::autoAttack( CharaPtr pTarget ) effectEntry.Arg1 = 7; //effectEntry.Arg2 = 0x71; effectPacket->setSequence( getCurrentTerritory()->getNextEffectSequence() ); - effectPacket->addTargetEffect( effectEntry, static_cast< uint64_t >( pTarget->getId() ) ); + effectPacket->addTargetEffect( effectEntry ); sendToInRangeSet( effectPacket ); diff --git a/src/world/Actor/Player.cpp b/src/world/Actor/Player.cpp index 62357d10..82e9df4e 100644 --- a/src/world/Actor/Player.cpp +++ b/src/world/Actor/Player.cpp @@ -1009,7 +1009,7 @@ void Sapphire::Entity::Player::despawn( Entity::PlayerPtr pTarget ) pPlayer->freePlayerSpawnId( getId() ); - pPlayer->queuePacket( makeActorControlSelf( getId(), DespawnZoneScreenMsg, 0x04, getId(), 0x01 ) ); + pPlayer->queuePacket( makeActorControlSelf( getId(), WarpStart, 0x04, getId(), 0x01 ) ); } Sapphire::Entity::GameObjectPtr Sapphire::Entity::Player::lookupTargetById( uint64_t targetId ) @@ -1525,7 +1525,7 @@ void Sapphire::Entity::Player::autoAttack( CharaPtr pTarget ) effectPacket->setSequence( getCurrentTerritory()->getNextEffectSequence() ); effectPacket->setRotation( Util::floatToUInt16Rot( getRot() ) ); - effectPacket->addTargetEffect( entry, static_cast< uint64_t >( pTarget->getId() ) ); + effectPacket->addTargetEffect( entry ); sendToInRangeSet( effectPacket, true ); diff --git a/src/world/Network/Handlers/PacketHandlers.cpp b/src/world/Network/Handlers/PacketHandlers.cpp index 017f1780..e879d85c 100644 --- a/src/world/Network/Handlers/PacketHandlers.cpp +++ b/src/world/Network/Handlers/PacketHandlers.cpp @@ -332,7 +332,7 @@ void Sapphire::Network::GameConnection::zoneJumpHandler( const Packets::FFXIVARR if( pExitRange ) { auto pPopRange = instanceObjectCache.getPopRange( pExitRange->data.destTerritoryType, - pExitRange->data.destInstanceObjectId ); + pExitRange->data.destInstanceObjectId ); if( pPopRange ) { targetZone = pExitRange->data.destTerritoryType; @@ -355,10 +355,19 @@ void Sapphire::Network::GameConnection::zoneJumpHandler( const Packets::FFXIVARR pPopRange->header.transform.rotation.z, rotation ); - // auto preparePacket = makeZonePacket< FFXIVIpcPrepareZoning >( player.getId() ); - // preparePacket->data().targetZone = pExitRange->data.destTerritoryType; + server.queueForPlayer( player.getCharacterId(), makeActorControlSelf( player.getId(), WarpStart, 0x03, player.getId(), 0x01, targetZone ) ); - //server.queueForPlayer( player.getCharacterId(), preparePacket ); + auto moveTerritoryPacket = makeZonePacket< FFXIVIpcMoveTerritory >( player.getId() ); + moveTerritoryPacket->data().index = -1; + moveTerritoryPacket->data().territoryType = targetZone; + moveTerritoryPacket->data().zoneId = player.getZoneId(); + moveTerritoryPacket->data().worldId = server.getWorldId(); + moveTerritoryPacket->data().worldId1 = server.getWorldId(); + moveTerritoryPacket->data().landId = -1; + moveTerritoryPacket->data().landSetId = -1; + moveTerritoryPacket->data().landTerritoryId = -1; + strcpy( moveTerritoryPacket->data().worldName, "Sapphire" ); + server.queueForPlayer( player.getCharacterId(), moveTerritoryPacket ); } } diff --git a/src/world/Network/PacketWrappers/EffectPacket1.h b/src/world/Network/PacketWrappers/EffectPacket1.h index 10f010d9..28f0fe99 100644 --- a/src/world/Network/PacketWrappers/EffectPacket1.h +++ b/src/world/Network/PacketWrappers/EffectPacket1.h @@ -34,12 +34,12 @@ namespace Sapphire::Network::Packets::WorldPackets::Server std::memset( &m_data.CalcResult, 0, sizeof( Common::CalcResult ) ); } - void addTargetEffect( const Common::CalcResultParam& effect, uint64_t targetId = Common::INVALID_GAME_OBJECT_ID64 ) + void addTargetEffect( const Common::CalcResultParam& effect ) { std::memcpy( &m_data.CalcResult.CalcResultTg[ m_targetEffectCount++ ], &effect, sizeof( Common::CalcResultParam ) ); } - void addSourceEffect( const Common::CalcResultParam& effect, uint64_t targetId = Common::INVALID_GAME_OBJECT_ID64 ) + void addSourceEffect( const Common::CalcResultParam& effect ) { std::memcpy( &m_data.CalcResult.CalcResultCt[ m_sourceEffectCount++ ], &effect, sizeof( Common::CalcResultParam ) ); } diff --git a/src/world/Network/PacketWrappers/PingPacket.h b/src/world/Network/PacketWrappers/PingPacket.h index 39bac0d3..0aaf6294 100644 --- a/src/world/Network/PacketWrappers/PingPacket.h +++ b/src/world/Network/PacketWrappers/PingPacket.h @@ -23,7 +23,8 @@ namespace Sapphire::Network::Packets::WorldPackets::Server private: void initialize( Entity::Player& player, int32_t inVal ) { - m_data.timeInMilliseconds = 0x000014D00000000 + inVal; + m_data.clientTimeValue = inVal; + m_data.transmissionInterval = 333; }; };