mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 14:37:44 +00:00
Packet rework of server_zone
This commit is contained in:
parent
685763ae73
commit
671576b861
34 changed files with 812 additions and 744 deletions
|
@ -9,6 +9,8 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <boost/make_shared.hpp>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Network {
|
namespace Network {
|
||||||
namespace Packets {
|
namespace Packets {
|
||||||
|
@ -17,16 +19,25 @@ namespace Packets {
|
||||||
// correct template functions.
|
// correct template functions.
|
||||||
|
|
||||||
template < typename T, typename T1 >
|
template < typename T, typename T1 >
|
||||||
class GamePacketNew;
|
class FFXIVIpcPacket;
|
||||||
|
|
||||||
template < typename T, typename T1 >
|
|
||||||
std::ostream& operator << ( std::ostream& os, const GamePacketNew< T, T1 >& packet );
|
|
||||||
|
|
||||||
template< class T >
|
template< class T >
|
||||||
using ZoneChannelPacket = GamePacketNew< T, ServerZoneIpcType >;
|
using ZoneChannelPacket = FFXIVIpcPacket< T, ServerZoneIpcType >;
|
||||||
|
|
||||||
template< class T >
|
template< class T >
|
||||||
using ChatChannelPacket = GamePacketNew< T, ServerChatIpcType >;
|
using ChatChannelPacket = FFXIVIpcPacket< T, ServerChatIpcType >;
|
||||||
|
|
||||||
|
template< class T, typename... Args >
|
||||||
|
boost::shared_ptr< ZoneChannelPacket< T > > makeZonePacket( Args... args )
|
||||||
|
{
|
||||||
|
return boost::make_shared< ZoneChannelPacket< T > >( args... );
|
||||||
|
}
|
||||||
|
|
||||||
|
template< class T, typename... Args >
|
||||||
|
boost::shared_ptr< ChatChannelPacket< T > > makeChatPacket( Args... args )
|
||||||
|
{
|
||||||
|
return boost::make_shared< ChatChannelPacket< T > >( args... );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base implementation of a game packet. Needed for parsing packets.
|
* The base implementation of a game packet. Needed for parsing packets.
|
||||||
|
@ -43,196 +54,220 @@ public:
|
||||||
virtual T1 ipcType() = 0;
|
virtual T1 ipcType() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
////////////////////////////////////////////////7
|
||||||
* A game packet, or IPC packet, object is a template class for constructing
|
|
||||||
* the data to be sent or parsed. The template works by accepting a structure
|
class FFXIVPacketBase
|
||||||
* type that represents just the IPC data portion (the bytes after the initial
|
|
||||||
* 32 byte header information.)
|
|
||||||
*/
|
|
||||||
template < typename T, typename T1 >
|
|
||||||
class GamePacketNew : public FFXIVIpcPacketBase< T1 >
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
FFXIVPacketBase() :
|
||||||
* @brief Constructs a new game packet with the specified actors.
|
m_segmentType( 0 )
|
||||||
* @param sourceActorId The source actor id.
|
|
||||||
* @param targetActorId The target actor id.
|
|
||||||
*/
|
|
||||||
GamePacketNew< T, T1 >( uint32_t sourceActorId, uint32_t targetActorId )
|
|
||||||
{
|
{
|
||||||
initialize();
|
initializeSegmentHeader();
|
||||||
m_segHdr.source_actor = sourceActorId;
|
}
|
||||||
m_segHdr.target_actor = targetActorId;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
FFXIVPacketBase( uint16_t segmentType, uint32_t sourceActorId, uint32_t targetActorId ) :
|
||||||
* @brief Constructs a new game packet with the specified actors.
|
m_segmentType( segmentType )
|
||||||
* @param sourceActorId The source and target actor id.
|
|
||||||
*/
|
|
||||||
GamePacketNew< T, T1 >( uint32_t bothActorId )
|
|
||||||
{
|
{
|
||||||
initialize();
|
initializeSegmentHeader();
|
||||||
m_segHdr.source_actor = bothActorId;
|
setSourceActor( sourceActorId );
|
||||||
m_segHdr.target_actor = bothActorId;
|
setTargetActor( targetActorId );
|
||||||
};
|
}
|
||||||
|
|
||||||
|
std::size_t getSize() const
|
||||||
|
{
|
||||||
|
return m_segHdr.size;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual std::vector< uint8_t > getData() const
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Initializes the fields of the header structures */
|
/** The segment header */
|
||||||
virtual void initialize( void )
|
FFXIVARR_PACKET_SEGMENT_HEADER m_segHdr;
|
||||||
{
|
uint16_t m_segmentType;
|
||||||
// Zero out the structures.
|
|
||||||
memset( &m_segHdr, 0, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
|
|
||||||
memset( &m_ipcHdr, 0, sizeof( FFXIVARR_IPC_HEADER ) );
|
|
||||||
memset( &m_data, 0, sizeof( T ) );
|
|
||||||
|
|
||||||
// Set the values of static fields.
|
|
||||||
// The size must be the sum of the segment header, the ipc header, and
|
|
||||||
// the IPC data itself.
|
|
||||||
m_segHdr.size = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + sizeof( FFXIVARR_IPC_HEADER ) + sizeof( T );
|
|
||||||
// Game packets (IPC) are type 3.
|
|
||||||
m_segHdr.type = 3;
|
|
||||||
// The IPC type itself.
|
|
||||||
m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType );
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual uint32_t getContentSize() { return 0; };
|
||||||
|
virtual std::vector< uint8_t > getContent() { return{}; };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the segment type of this packet.
|
||||||
|
*/
|
||||||
|
uint16_t getSegmentType() const
|
||||||
|
{
|
||||||
|
return m_segmentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the source actor id for this packet.
|
||||||
|
* @param actorId The source actor id.
|
||||||
|
*/
|
||||||
|
void setSourceActor( uint32_t actorId )
|
||||||
|
{
|
||||||
|
m_segHdr.source_actor = actorId;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the source actor id for this packet.
|
||||||
|
* @return The source actor id.
|
||||||
|
*/
|
||||||
|
uint32_t getSourceActor() const
|
||||||
|
{
|
||||||
|
return m_segHdr.source_actor;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the target actor id for this packet.
|
||||||
|
* @param actorId The target actor id.
|
||||||
|
*/
|
||||||
|
void setTargetActor( uint32_t actorId )
|
||||||
|
{
|
||||||
|
m_segHdr.target_actor = actorId;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Gets the target actor id for this packet.
|
||||||
|
*/
|
||||||
|
uint32_t getTargetActor( void ) const
|
||||||
|
{
|
||||||
|
return m_segHdr.target_actor;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Initializes the fields of the segment header structure */
|
||||||
|
virtual void initializeSegmentHeader( void )
|
||||||
|
{
|
||||||
|
// Zero out the structure.
|
||||||
|
memset( &m_segHdr, 0, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
|
||||||
|
|
||||||
|
// Set the values of static fields.
|
||||||
|
// The size must be the sum of the segment header and the content
|
||||||
|
m_segHdr.size = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + getContentSize();
|
||||||
|
m_segHdr.type = getSegmentType();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
template < typename T, typename T1 >
|
||||||
|
class FFXIVIpcPacket : public FFXIVIpcPacketBase< T1 >, public FFXIVPacketBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId, uint32_t targetActorId ) :
|
||||||
|
FFXIVPacketBase( 3, sourceActorId, targetActorId )
|
||||||
|
{
|
||||||
|
initialize();
|
||||||
|
};
|
||||||
|
|
||||||
|
FFXIVIpcPacket< T, T1 >( uint32_t sourceActorId ) :
|
||||||
|
FFXIVPacketBase( 3, sourceActorId, sourceActorId )
|
||||||
|
{
|
||||||
|
initialize();
|
||||||
|
};
|
||||||
|
|
||||||
|
uint32_t getContentSize() override
|
||||||
|
{
|
||||||
|
return sizeof( FFXIVARR_IPC_HEADER ) + sizeof( T );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector< uint8_t > getContent() override
|
||||||
|
{
|
||||||
|
std::vector< uint8_t > content( getContentSize() );
|
||||||
|
memcpy( content.data(), &m_ipcHdr, sizeof( FFXIVARR_IPC_HEADER ) );
|
||||||
|
memcpy( content.data() + sizeof( FFXIVARR_IPC_HEADER ), &m_data, sizeof( T ) );
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector< uint8_t > getData() const override
|
||||||
|
{
|
||||||
|
auto segmentHeaderSize = sizeof( FFXIVARR_PACKET_SEGMENT_HEADER );
|
||||||
|
auto ipcHeaderSize = sizeof( FFXIVARR_IPC_HEADER );
|
||||||
|
auto dataSize = sizeof( m_data );
|
||||||
|
|
||||||
|
std::vector< uint8_t > data( segmentHeaderSize + ipcHeaderSize + dataSize );
|
||||||
|
|
||||||
|
memcpy( &data[0], &m_segHdr, segmentHeaderSize );
|
||||||
|
memcpy( &data[segmentHeaderSize], &m_ipcHdr, ipcHeaderSize );
|
||||||
|
memcpy( &data[segmentHeaderSize + ipcHeaderSize], &m_data, dataSize );
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
virtual T1 ipcType()
|
virtual T1 ipcType()
|
||||||
{
|
{
|
||||||
return static_cast< T1 >( m_data._ServerIpcType );
|
return static_cast< T1 >( m_data._ServerIpcType );
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Gets a reference to the underlying IPC data structure. */
|
/** Gets a reference to the underlying IPC data structure. */
|
||||||
T& data( void ) { return m_data; };
|
T& data() { return m_data; };
|
||||||
|
|
||||||
/**
|
protected:
|
||||||
* @brief Sets the source actor id for this IPC packet.
|
/** Initializes the fields of the header structures */
|
||||||
* @param actorId The source actor id.
|
virtual void initialize()
|
||||||
* @return This IPC packet object (can be used for chaining).
|
|
||||||
*/
|
|
||||||
GamePacketNew< T, T1 > sourceActor( uint32_t actorId )
|
|
||||||
{
|
{
|
||||||
m_segHdr.source_actor = actorId;
|
// Zero out the structures.
|
||||||
return this;
|
memset( &m_ipcHdr, 0, sizeof( FFXIVARR_IPC_HEADER ) );
|
||||||
};
|
memset( &m_data, 0, sizeof( T ) );
|
||||||
|
|
||||||
/**
|
// The IPC type itself.
|
||||||
* @brief Gets the source actor id for this IPC packet.
|
m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType );
|
||||||
* @return The source actor id.
|
|
||||||
*/
|
|
||||||
uint32_t sourceActor( void ) const
|
|
||||||
{
|
|
||||||
return m_segHdr.source_actor;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Sets the target actor id for this IPC packet.
|
|
||||||
* @param actorId The target actor id.
|
|
||||||
* @return This IPC packet object (can be used for chaining).
|
|
||||||
*/
|
|
||||||
GamePacketNew< T, T1 > targetActor( uint32_t actorId )
|
|
||||||
{
|
|
||||||
m_segHdr.target_actor = actorId;
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Gets the target actor id for this IPC packet.
|
|
||||||
* @return The target actor id.
|
|
||||||
*/
|
|
||||||
uint32_t targetActor( void ) const
|
|
||||||
{
|
|
||||||
return m_segHdr.target_actor;
|
|
||||||
};
|
|
||||||
|
|
||||||
friend std::ostream& operator<< <> ( std::ostream& os, const GamePacketNew< T, T1 >& packet );
|
|
||||||
|
|
||||||
friend class GamePacketFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Adapts the new-style packet into the old style.
|
|
||||||
*/
|
|
||||||
operator GamePacket* ( ) const
|
|
||||||
{
|
|
||||||
std::ostringstream buf;
|
|
||||||
serialize( buf );
|
|
||||||
// NOTE: This should be ok because CGamePacket's constructor will
|
|
||||||
// copy the contents of the buffer.
|
|
||||||
GamePacket* pOldStyle = new GamePacket( const_cast< char* >( buf.str().c_str() ), m_segHdr.size, false );
|
|
||||||
return pOldStyle;
|
|
||||||
};
|
|
||||||
|
|
||||||
operator GamePacketPtr () const
|
|
||||||
{
|
|
||||||
std::ostringstream buf;
|
|
||||||
serialize( buf );
|
|
||||||
// NOTE: This should be ok because CGamePacket's constructor will
|
|
||||||
// copy the contents of the buffer.
|
|
||||||
GamePacketPtr pOldStyle( new GamePacket( const_cast< char* >( buf.str().c_str() ), m_segHdr.size, true ) );
|
|
||||||
return pOldStyle;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// TODO: Is this a waste of storage memory?
|
|
||||||
/** The segment header */
|
|
||||||
FFXIVARR_PACKET_SEGMENT_HEADER m_segHdr;
|
|
||||||
/** The IPC packet header */
|
/** The IPC packet header */
|
||||||
FFXIVARR_IPC_HEADER m_ipcHdr;
|
FFXIVARR_IPC_HEADER m_ipcHdr;
|
||||||
/** The underlying data portion of the packet as a structure */
|
/** The underlying data portion of the packet as a structure */
|
||||||
T m_data;
|
T m_data;
|
||||||
|
|
||||||
private:
|
|
||||||
std::ostream& serialize( std::ostream& os ) const
|
|
||||||
{
|
|
||||||
// Since the packet itself is constant, we need to make a copy of the IPC
|
|
||||||
// header in order to set the timestamp.
|
|
||||||
FFXIVARR_IPC_HEADER ipcHdr;
|
|
||||||
memcpy( &ipcHdr, &m_ipcHdr, sizeof( ipcHdr ) );
|
|
||||||
|
|
||||||
// TODO: Fixed timestamp? Can we use a manipulator on the stream to assign
|
|
||||||
// a fixed timestamp value. This might be useful if several packets must
|
|
||||||
// be sent having the exact same timestamp. (Maybe this doesn't really
|
|
||||||
// need to happen though...)
|
|
||||||
ipcHdr.timestamp = static_cast< uint32_t >( time( nullptr ) );
|
|
||||||
|
|
||||||
// TODO: What about encryption? compression?
|
|
||||||
// Ideally, these could come directly from the stream using manipulators.
|
|
||||||
// We could check the stream's flags, and perform the appropriate
|
|
||||||
// operations here. The snag is encryption, which does not occur for
|
|
||||||
// segment headers, but may occur for IPC headers, and their data.
|
|
||||||
// Compression occurs for the entire segment header down.
|
|
||||||
os << m_segHdr << ipcHdr;
|
|
||||||
return os.write( reinterpret_cast< const char* >( &m_data ), sizeof( T ) );
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template < typename T, typename T1 >
|
|
||||||
std::ostream& operator<<( std::ostream& os, const GamePacketNew<T, T1>& packet )
|
class FFXIVRawPacket : public FFXIVPacketBase
|
||||||
{
|
{
|
||||||
#if 0
|
public:
|
||||||
// Since the packet itself is constant, we need to make a copy of the IPC
|
FFXIVRawPacket( uint16_t type, uint32_t size, uint32_t sourceActorId, uint32_t targetActorId ) :
|
||||||
// header in order to set the timestamp.
|
FFXIVPacketBase( type, sourceActorId, targetActorId )
|
||||||
FFXIVARR_IPC_HEADER ipcHdr;
|
{
|
||||||
memcpy( &ipcHdr, &packet.m_ipcHdr, sizeof( ipcHdr ) );
|
m_data.resize( size - sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
|
||||||
|
initialize();
|
||||||
|
m_segHdr.size = size;
|
||||||
|
};
|
||||||
|
|
||||||
// TODO: Fixed timestamp? Can we use a manipulator on the stream to assign
|
uint32_t getContentSize() override
|
||||||
// a fixed timestamp value. This might be useful if several packets must
|
{
|
||||||
// be sent having the exact same timestamp. (Maybe this doesn't really
|
return m_data.size();
|
||||||
// need to happen though...)
|
}
|
||||||
ipcHdr.timestamp = time( NULL );
|
|
||||||
|
std::vector< uint8_t > getContent() override
|
||||||
|
{
|
||||||
|
return m_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual std::vector< uint8_t > getData() const override
|
||||||
|
{
|
||||||
|
std::vector< uint8_t > data( sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) + m_data.size() );
|
||||||
|
|
||||||
|
memcpy( &data[0], &m_segHdr, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
|
||||||
|
memcpy( &data[sizeof( FFXIVARR_PACKET_SEGMENT_HEADER )], &m_data[0], m_data.size() );
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets a reference to the underlying IPC data structure. */
|
||||||
|
std::vector< uint8_t >& data() { return m_data; };
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/** Initializes the fields of the header structures */
|
||||||
|
virtual void initialize()
|
||||||
|
{
|
||||||
|
// Zero out the structures.
|
||||||
|
memset( &m_data[0], 0, m_data.size() );
|
||||||
|
};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/** The underlying data portion of the packet as a structure */
|
||||||
|
std::vector< uint8_t > m_data;
|
||||||
|
};
|
||||||
|
|
||||||
// TODO: What about encryption? compression?
|
|
||||||
// Ideally, these could come directly from the stream using manipulators.
|
|
||||||
// We could check the stream's flags, and perform the appropriate
|
|
||||||
// operations here. The snag is encryption, which does not occur for
|
|
||||||
// segment headers, but may occur for IPC headers, and their data.
|
|
||||||
// Compression occurs for the entire segment header down.
|
|
||||||
os << packet.m_segHdr << ipcHdr;
|
|
||||||
return os.write(
|
|
||||||
reinterpret_cast< const char* >( &packet.m_data ), sizeof( T ) );
|
|
||||||
#else
|
|
||||||
return packet.serialize( os );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* Packets */
|
} /* Packets */
|
||||||
} /* Network */
|
} /* Network */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "PacketContainer.h"
|
#include "PacketContainer.h"
|
||||||
#include "GamePacket.h"
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
|
@ -19,18 +19,18 @@ Core::Network::Packets::PacketContainer::~PacketContainer()
|
||||||
m_entryList.clear();
|
m_entryList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Network::Packets::PacketContainer::addPacket( GamePacket pEntry )
|
void Core::Network::Packets::PacketContainer::addPacket( FFXIVPacketBase entry )
|
||||||
{
|
{
|
||||||
m_entryList.push_back( pEntry );
|
m_entryList.push_back( entry );
|
||||||
|
|
||||||
m_ipcHdr.size += pEntry.getSize();
|
m_ipcHdr.size += entry.getSize();
|
||||||
m_ipcHdr.count++;
|
m_ipcHdr.count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Network::Packets::PacketContainer::fillSendBuffer( std::vector< uint8_t >& sendBuffer )
|
void Core::Network::Packets::PacketContainer::fillSendBuffer( std::vector< uint8_t >& sendBuffer )
|
||||||
{
|
{
|
||||||
uint8_t* tempBuffer = new uint8_t[m_ipcHdr.size];
|
std::vector< uint8_t > tempBuffer( m_ipcHdr.size );
|
||||||
memset( tempBuffer, 0, m_ipcHdr.size );
|
memset( &tempBuffer[0], 0, m_ipcHdr.size );
|
||||||
|
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
auto ms = duration_cast< milliseconds >( system_clock::now().time_since_epoch() );
|
auto ms = duration_cast< milliseconds >( system_clock::now().time_since_epoch() );
|
||||||
|
@ -40,23 +40,22 @@ void Core::Network::Packets::PacketContainer::fillSendBuffer( std::vector< uint8
|
||||||
m_ipcHdr.timestamp = tick;
|
m_ipcHdr.timestamp = tick;
|
||||||
m_ipcHdr.unknown_20 = 1;
|
m_ipcHdr.unknown_20 = 1;
|
||||||
|
|
||||||
memcpy( tempBuffer, &m_ipcHdr, sizeof( FFXIVARR_PACKET_HEADER ) );
|
memcpy( &tempBuffer[0], &m_ipcHdr, sizeof( FFXIVARR_PACKET_HEADER ) );
|
||||||
|
|
||||||
auto it = m_entryList.begin();
|
auto it = m_entryList.begin();
|
||||||
uint16_t offset = 0;
|
std::size_t offset = 0;
|
||||||
|
|
||||||
if( m_entryList.size() > 1 )
|
if( m_entryList.size() > 1 )
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
||||||
for( ; it != m_entryList.end(); ++it )
|
for( ; it != m_entryList.end(); ++it )
|
||||||
{
|
{
|
||||||
memcpy( tempBuffer + sizeof( FFXIVARR_PACKET_HEADER ) + offset, it->getData(), it->m_segHdr.size );
|
auto data = it->getData();
|
||||||
offset += it->m_segHdr.size;
|
memcpy( &tempBuffer[0] + sizeof( FFXIVARR_PACKET_HEADER ) + offset, &data[0], it->getSize() );
|
||||||
|
offset += it->getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
sendBuffer.assign( tempBuffer, tempBuffer + m_ipcHdr.size );
|
sendBuffer.assign( &tempBuffer[0], &tempBuffer[0] + m_ipcHdr.size );
|
||||||
|
|
||||||
delete[] tempBuffer;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "CommonNetwork.h"
|
#include "CommonNetwork.h"
|
||||||
#include "GamePacket.h"
|
#include "GamePacketNew.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Network {
|
namespace Network {
|
||||||
|
@ -19,11 +19,11 @@ public:
|
||||||
PacketContainer();
|
PacketContainer();
|
||||||
~PacketContainer();
|
~PacketContainer();
|
||||||
|
|
||||||
void addPacket( GamePacket pEntry );
|
void addPacket( FFXIVPacketBase entry );
|
||||||
|
|
||||||
FFXIVARR_PACKET_HEADER m_ipcHdr;
|
FFXIVARR_PACKET_HEADER m_ipcHdr;
|
||||||
|
|
||||||
std::vector< GamePacket > m_entryList;
|
std::vector< FFXIVPacketBase > m_entryList;
|
||||||
|
|
||||||
std::string toString();
|
std::string toString();
|
||||||
|
|
||||||
|
|
|
@ -49,14 +49,14 @@ void Core::Action::ActionCast::onStart()
|
||||||
m_pSource->getAsPlayer()->sendDebug( "onStart()" );
|
m_pSource->getAsPlayer()->sendDebug( "onStart()" );
|
||||||
m_startTime = Util::getTimeMs();
|
m_startTime = Util::getTimeMs();
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcActorCast > castPacket( m_pSource->getId() );
|
auto castPacket = makeZonePacket< FFXIVIpcActorCast >( getId() );
|
||||||
|
|
||||||
castPacket.data().action_id = m_id;
|
castPacket->data().action_id = m_id;
|
||||||
castPacket.data().skillType = Common::SkillType::Normal;
|
castPacket->data().skillType = Common::SkillType::Normal;
|
||||||
castPacket.data().unknown_1 = m_id;
|
castPacket->data().unknown_1 = m_id;
|
||||||
// This is used for the cast bar above the target bar of the caster.
|
// This is used for the cast bar above the target bar of the caster.
|
||||||
castPacket.data().cast_time = static_cast< float >( m_castTime / 1000 );
|
castPacket->data().cast_time = static_cast< float >( m_castTime / 1000 );
|
||||||
castPacket.data().target_id = m_pTarget->getId();
|
castPacket->data().target_id = m_pTarget->getId();
|
||||||
|
|
||||||
m_pSource->sendToInRangeSet( castPacket, true );
|
m_pSource->sendToInRangeSet( castPacket, true );
|
||||||
m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Casting );
|
m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Casting );
|
||||||
|
@ -90,8 +90,8 @@ void Core::Action::ActionCast::onInterrupt()
|
||||||
//m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 );
|
//m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 );
|
||||||
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting );
|
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting );
|
||||||
|
|
||||||
auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt,
|
auto control = boost::make_shared< ActorControlPacket142 >( m_pSource->getId(), ActorControlType::CastInterrupt,
|
||||||
0x219, 1, m_id, 0 );
|
0x219, 1, m_id, 0 );
|
||||||
|
|
||||||
// Note: When cast interrupt from taking too much damage, set the last value to 1. This enables the cast interrupt effect. Example:
|
// Note: When cast interrupt from taking too much damage, set the last value to 1. This enables the cast interrupt effect. Example:
|
||||||
// auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 1, m_id, 0 );
|
// auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 1, m_id, 0 );
|
||||||
|
|
|
@ -48,14 +48,13 @@ void Core::Action::ActionMount::onStart()
|
||||||
m_pSource->getAsPlayer()->sendDebug( "ActionMount::onStart()" );
|
m_pSource->getAsPlayer()->sendDebug( "ActionMount::onStart()" );
|
||||||
m_startTime = Util::getTimeMs();
|
m_startTime = Util::getTimeMs();
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcActorCast > castPacket( m_pSource->getId() );
|
auto castPacket = makeZonePacket< FFXIVIpcActorCast >( getId() );
|
||||||
|
castPacket->data().action_id = m_id;
|
||||||
castPacket.data().action_id = m_id;
|
castPacket->data().skillType = Common::SkillType::MountSkill;
|
||||||
castPacket.data().skillType = Common::SkillType::MountSkill;
|
castPacket->data().unknown_1 = m_id;
|
||||||
castPacket.data().unknown_1 = m_id;
|
|
||||||
// This is used for the cast bar above the target bar of the caster.
|
// This is used for the cast bar above the target bar of the caster.
|
||||||
castPacket.data().cast_time = static_cast< float >( m_castTime / 1000 );
|
castPacket->data().cast_time = static_cast< float >( m_castTime / 1000 );
|
||||||
castPacket.data().target_id = m_pSource->getAsPlayer()->getId();
|
castPacket->data().target_id = m_pSource->getAsPlayer()->getId();
|
||||||
|
|
||||||
m_pSource->sendToInRangeSet( castPacket, true );
|
m_pSource->sendToInRangeSet( castPacket, true );
|
||||||
m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Casting );
|
m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Casting );
|
||||||
|
@ -72,18 +71,19 @@ void Core::Action::ActionMount::onFinish()
|
||||||
|
|
||||||
pPlayer->unsetStateFlag( PlayerStateFlag::Casting );
|
pPlayer->unsetStateFlag( PlayerStateFlag::Casting );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcEffect > effectPacket( pPlayer->getId() );
|
auto effectPacket = makeZonePacket< FFXIVIpcEffect >( getId() );
|
||||||
effectPacket.data().targetId = pPlayer->getId();
|
|
||||||
effectPacket.data().actionAnimationId = m_id;
|
effectPacket->data().targetId = pPlayer->getId();
|
||||||
|
effectPacket->data().actionAnimationId = m_id;
|
||||||
// Affects displaying action name next to number in floating text
|
// Affects displaying action name next to number in floating text
|
||||||
effectPacket.data().unknown_62 = 13;
|
effectPacket->data().unknown_62 = 13;
|
||||||
effectPacket.data().actionTextId = 4;
|
effectPacket->data().actionTextId = 4;
|
||||||
effectPacket.data().numEffects = 1;
|
effectPacket->data().numEffects = 1;
|
||||||
effectPacket.data().rotation = Math::Util::floatToUInt16Rot( pPlayer->getRot() );
|
effectPacket->data().rotation = Math::Util::floatToUInt16Rot( pPlayer->getRot() );
|
||||||
effectPacket.data().effectTarget = INVALID_GAME_OBJECT_ID;
|
effectPacket->data().effectTarget = INVALID_GAME_OBJECT_ID;
|
||||||
effectPacket.data().effects[0].effectType = ActionEffectType::Mount;
|
effectPacket->data().effects[0].effectType = ActionEffectType::Mount;
|
||||||
effectPacket.data().effects[0].hitSeverity = ActionHitSeverityType::CritDamage;
|
effectPacket->data().effects[0].hitSeverity = ActionHitSeverityType::CritDamage;
|
||||||
effectPacket.data().effects[0].value = m_id;
|
effectPacket->data().effects[0].value = m_id;
|
||||||
|
|
||||||
pPlayer->sendToInRangeSet( effectPacket, true );
|
pPlayer->sendToInRangeSet( effectPacket, true );
|
||||||
|
|
||||||
|
@ -98,8 +98,8 @@ void Core::Action::ActionMount::onInterrupt()
|
||||||
//m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 );
|
//m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 );
|
||||||
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting );
|
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting );
|
||||||
|
|
||||||
auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt,
|
auto control = boost::make_shared< ActorControlPacket142 >( m_pSource->getId(), ActorControlType::CastInterrupt,
|
||||||
0x219, 1, m_id, 0 );
|
0x219, 1, m_id, 0 );
|
||||||
|
|
||||||
// Note: When cast interrupt from taking too much damage, set the last value to 1. This enables the cast interrupt effect. Example:
|
// Note: When cast interrupt from taking too much damage, set the last value to 1. This enables the cast interrupt effect. Example:
|
||||||
// auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 1, m_id, 0 );
|
// auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt, 0x219, 1, m_id, 0 );
|
||||||
|
|
|
@ -47,12 +47,11 @@ void Core::Action::ActionTeleport::onStart()
|
||||||
|
|
||||||
m_startTime = Util::getTimeMs();
|
m_startTime = Util::getTimeMs();
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcActorCast > castPacket( m_pSource->getId() );
|
auto castPacket = makeZonePacket< FFXIVIpcActorCast >( getId() );
|
||||||
|
castPacket->data().action_id = 5;
|
||||||
castPacket.data().action_id = 5;
|
castPacket->data().unknown = 1;
|
||||||
castPacket.data().unknown = 1;
|
castPacket->data().cast_time = 5.0f;
|
||||||
castPacket.data().cast_time = 5.0f;
|
castPacket->data().target_id = m_pSource->getId();
|
||||||
castPacket.data().target_id = m_pSource->getId();
|
|
||||||
|
|
||||||
m_pSource->sendToInRangeSet( castPacket, true );
|
m_pSource->sendToInRangeSet( castPacket, true );
|
||||||
m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Casting );
|
m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Casting );
|
||||||
|
@ -83,15 +82,15 @@ void Core::Action::ActionTeleport::onFinish()
|
||||||
|
|
||||||
pPlayer->setZoningType( ZoneingType::Teleport );
|
pPlayer->setZoningType( ZoneingType::Teleport );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcEffect > effectPacket( pPlayer->getId() );
|
auto effectPacket = makeZonePacket< FFXIVIpcEffect >( getId() );
|
||||||
effectPacket.data().targetId = pPlayer->getId();
|
effectPacket->data().targetId = pPlayer->getId();
|
||||||
effectPacket.data().actionAnimationId = 5;
|
effectPacket->data().actionAnimationId = 5;
|
||||||
//effectPacket.data().unknown_3 = 1;
|
//effectPacket.data().unknown_3 = 1;
|
||||||
effectPacket.data().actionTextId = 5;
|
effectPacket->data().actionTextId = 5;
|
||||||
effectPacket.data().unknown_5 = 1;
|
effectPacket->data().unknown_5 = 1;
|
||||||
effectPacket.data().numEffects = 1;
|
effectPacket->data().numEffects = 1;
|
||||||
effectPacket.data().rotation = static_cast< uint16_t >( 0x8000 * ( ( pPlayer->getRot() + 3.1415926 ) ) / 3.1415926 );
|
effectPacket->data().rotation = static_cast< uint16_t >( 0x8000 * ( ( pPlayer->getRot() + 3.1415926 ) ) / 3.1415926 );
|
||||||
effectPacket.data().effectTarget = pPlayer->getId();
|
effectPacket->data().effectTarget = pPlayer->getId();
|
||||||
pPlayer->sendToInRangeSet( effectPacket, true );
|
pPlayer->sendToInRangeSet( effectPacket, true );
|
||||||
|
|
||||||
pPlayer->teleport( m_targetAetheryte );
|
pPlayer->teleport( m_targetAetheryte );
|
||||||
|
@ -106,8 +105,8 @@ void Core::Action::ActionTeleport::onInterrupt()
|
||||||
|
|
||||||
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting );
|
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting );
|
||||||
|
|
||||||
auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt,
|
auto control = boost::make_shared< ActorControlPacket142 >( m_pSource->getId(), ActorControlType::CastInterrupt,
|
||||||
0x219, 0x04, m_id, 0 );
|
0x219, 0x04, m_id, 0 );
|
||||||
m_pSource->sendToInRangeSet( control, true );
|
m_pSource->sendToInRangeSet( control, true );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,8 @@ void Core::Action::EventAction::onStart()
|
||||||
|
|
||||||
m_startTime = Util::getTimeMs();
|
m_startTime = Util::getTimeMs();
|
||||||
|
|
||||||
auto control = ActorControlPacket142( m_pSource->getId(), Common::ActorControlType::CastStart,
|
auto control = boost::make_shared< ActorControlPacket142 >( m_pSource->getId(), Common::ActorControlType::CastStart,
|
||||||
1, m_id, 0x4000004E );
|
1, m_id, 0x4000004E );
|
||||||
|
|
||||||
if( m_pSource->isPlayer() )
|
if( m_pSource->isPlayer() )
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,8 @@ void Core::Action::EventAction::onFinish()
|
||||||
if( m_onActionFinishClb )
|
if( m_onActionFinishClb )
|
||||||
m_onActionFinishClb( *m_pSource->getAsPlayer(), m_eventId, m_additional );
|
m_onActionFinishClb( *m_pSource->getAsPlayer(), m_eventId, m_additional );
|
||||||
|
|
||||||
auto control = ActorControlPacket142( m_pSource->getId(), Common::ActorControlType::CastStart, 0, m_id );
|
auto control = boost::make_shared< ActorControlPacket142 >( m_pSource->getId(), Common::ActorControlType::CastStart,
|
||||||
|
0, m_id );
|
||||||
|
|
||||||
if( !pEvent->hasPlayedScene() )
|
if( !pEvent->hasPlayedScene() )
|
||||||
m_pSource->getAsPlayer()->eventFinish( m_eventId, 1 );
|
m_pSource->getAsPlayer()->eventFinish( m_eventId, 1 );
|
||||||
|
@ -108,12 +109,13 @@ void Core::Action::EventAction::onInterrupt()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt,
|
auto control = boost::make_shared< ActorControlPacket142 >( m_pSource->getId(), ActorControlType::CastInterrupt,
|
||||||
0x219, 0x04, m_id );
|
0x219, 0x04, m_id );
|
||||||
|
|
||||||
if( m_pSource->isPlayer() )
|
if( m_pSource->isPlayer() )
|
||||||
{
|
{
|
||||||
auto control1 = ActorControlPacket143( m_pSource->getId(), ActorControlType::FreeEventPos, m_eventId );
|
auto control1 = boost::make_shared< ActorControlPacket143 >( m_pSource->getId(), ActorControlType::FreeEventPos,
|
||||||
|
m_eventId );
|
||||||
|
|
||||||
//m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::NoCombat );
|
//m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::NoCombat );
|
||||||
//m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 );
|
//m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Occupied1 );
|
||||||
|
|
|
@ -48,13 +48,12 @@ void Core::Action::EventItemAction::onStart()
|
||||||
|
|
||||||
m_startTime = Util::getTimeMs();
|
m_startTime = Util::getTimeMs();
|
||||||
|
|
||||||
GamePacketNew< FFXIVIpcActorCast, ServerZoneIpcType > castPacket( m_pSource->getId() );
|
auto castPacket = makeZonePacket< FFXIVIpcActorCast >( m_pSource->getId() );
|
||||||
|
castPacket->data().action_id = 1;
|
||||||
castPacket.data().action_id = 1;
|
castPacket->data().unknown = 3;
|
||||||
castPacket.data().unknown = 3;
|
castPacket->data().unknown_1 = m_id;
|
||||||
castPacket.data().unknown_1 = m_id;
|
castPacket->data().cast_time = 3.0f;
|
||||||
castPacket.data().cast_time = 3.0f;
|
castPacket->data().target_id = m_pSource->getId();
|
||||||
castPacket.data().target_id = m_pSource->getId();
|
|
||||||
|
|
||||||
m_pSource->sendToInRangeSet( castPacket, true );
|
m_pSource->sendToInRangeSet( castPacket, true );
|
||||||
m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Casting );
|
m_pSource->getAsPlayer()->setStateFlag( PlayerStateFlag::Casting );
|
||||||
|
@ -68,15 +67,15 @@ void Core::Action::EventItemAction::onFinish()
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GamePacketNew< FFXIVIpcEffect, ServerZoneIpcType > effectPacket( m_pSource->getId() );
|
auto effectPacket = makeZonePacket< FFXIVIpcEffect >( m_pSource->getId() );
|
||||||
effectPacket.data().targetId = static_cast< uint32_t >( m_additional );
|
effectPacket->data().targetId = static_cast< uint32_t >( m_additional );
|
||||||
effectPacket.data().actionAnimationId = 1;
|
effectPacket->data().actionAnimationId = 1;
|
||||||
// effectPacket.data().unknown_3 = 3;
|
// effectPacket.data().unknown_3 = 3;
|
||||||
effectPacket.data().actionTextId = m_id;
|
effectPacket->data().actionTextId = m_id;
|
||||||
effectPacket.data().unknown_5 = 2;
|
effectPacket->data().unknown_5 = 2;
|
||||||
effectPacket.data().numEffects = 1;
|
effectPacket->data().numEffects = 1;
|
||||||
effectPacket.data().rotation = Math::Util::floatToUInt16Rot( m_pSource->getRot() );
|
effectPacket->data().rotation = Math::Util::floatToUInt16Rot( m_pSource->getRot() );
|
||||||
effectPacket.data().effectTarget = static_cast< uint32_t >( m_additional );
|
effectPacket->data().effectTarget = static_cast< uint32_t >( m_additional );
|
||||||
|
|
||||||
m_pSource->getAsPlayer()->unsetStateFlag( Common::PlayerStateFlag::Casting );
|
m_pSource->getAsPlayer()->unsetStateFlag( Common::PlayerStateFlag::Casting );
|
||||||
m_pSource->sendToInRangeSet( effectPacket, true );
|
m_pSource->sendToInRangeSet( effectPacket, true );
|
||||||
|
@ -100,8 +99,8 @@ void Core::Action::EventItemAction::onInterrupt()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
auto control = ActorControlPacket142( m_pSource->getId(), ActorControlType::CastInterrupt,
|
auto control = boost::make_shared< ActorControlPacket142 >( m_pSource->getId(), ActorControlType::CastInterrupt,
|
||||||
0x219, 0x04, m_id );
|
0x219, 0x04, m_id );
|
||||||
if( m_pSource->isPlayer() )
|
if( m_pSource->isPlayer() )
|
||||||
{
|
{
|
||||||
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting );
|
m_pSource->getAsPlayer()->unsetStateFlag( PlayerStateFlag::Casting );
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <Util/Util.h>
|
#include <Util/Util.h>
|
||||||
#include <Util/UtilMath.h>
|
#include <Util/UtilMath.h>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "Action/Action.h"
|
#include "Action/Action.h"
|
||||||
#include "Action/ActionCollision.h"
|
#include "Action/ActionCollision.h"
|
||||||
|
@ -278,7 +279,7 @@ Send a packet to all players in range, potentially to self if set and is player
|
||||||
\param GamePacketPtr to send
|
\param GamePacketPtr to send
|
||||||
\param bool should be send to self?
|
\param bool should be send to self?
|
||||||
*/
|
*/
|
||||||
void Core::Entity::Actor::sendToInRangeSet( Network::Packets::GamePacketPtr pPacket, bool bToSelf )
|
void Core::Entity::Actor::sendToInRangeSet( Network::Packets::FFXIVPacketBasePtr pPacket, bool bToSelf )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerZone >();
|
auto pServerZone = g_fw.get< ServerZone >();
|
||||||
if( bToSelf && isPlayer() )
|
if( bToSelf && isPlayer() )
|
||||||
|
@ -289,7 +290,7 @@ void Core::Entity::Actor::sendToInRangeSet( Network::Packets::GamePacketPtr pPac
|
||||||
|
|
||||||
// it might be that the player DC'd in which case the session would be invalid
|
// it might be that the player DC'd in which case the session would be invalid
|
||||||
if( pSession )
|
if( pSession )
|
||||||
pSession->getZoneConnection()->queueOutPacket( pPacket );
|
pSession->getZoneConnection()->queueOutPacket( std::move( pPacket ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_inRangePlayers.empty() )
|
if( m_inRangePlayers.empty() )
|
||||||
|
@ -298,10 +299,11 @@ void Core::Entity::Actor::sendToInRangeSet( Network::Packets::GamePacketPtr pPac
|
||||||
for( const auto &pCurAct : m_inRangePlayers )
|
for( const auto &pCurAct : m_inRangePlayers )
|
||||||
{
|
{
|
||||||
assert( pCurAct );
|
assert( pCurAct );
|
||||||
pPacket->setValAt< uint32_t >( 0x04, m_id );
|
pPacket->setSourceActor( m_id );
|
||||||
pPacket->setValAt< uint32_t >( 0x08, pCurAct->getId() );
|
pPacket->setTargetActor( pCurAct->getId() );
|
||||||
// it might be that the player DC'd in which case the session would be invalid
|
// it might be that the player DC'd in which case the session would be invalid
|
||||||
pCurAct->queuePacket( pPacket );
|
// TODO: copy packet to a new unique_ptr then move ownership
|
||||||
|
//pCurAct->queuePacket( pPacket );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ namespace Entity {
|
||||||
|
|
||||||
ActorPtr getClosestActor();
|
ActorPtr getClosestActor();
|
||||||
|
|
||||||
void sendToInRangeSet( Network::Packets::GamePacketPtr pPacket, bool bToSelf = false );
|
void sendToInRangeSet( Network::Packets::FFXIVPacketBasePtr pPacket, bool bToSelf = false );
|
||||||
|
|
||||||
// add an actor to in range set
|
// add an actor to in range set
|
||||||
void addInRangeActor( ActorPtr pActor );
|
void addInRangeActor( ActorPtr pActor );
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <Util/UtilMath.h>
|
#include <Util/UtilMath.h>
|
||||||
#include <Network/PacketContainer.h>
|
#include <Network/PacketContainer.h>
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "Forwards.h"
|
#include "Forwards.h"
|
||||||
#include "Action/Action.h"
|
#include "Action/Action.h"
|
||||||
|
@ -211,11 +212,16 @@ void Core::Entity::Chara::die()
|
||||||
// if the actor is a player, the update needs to be send to himself too
|
// if the actor is a player, the update needs to be send to himself too
|
||||||
bool selfNeedsUpdate = isPlayer();
|
bool selfNeedsUpdate = isPlayer();
|
||||||
|
|
||||||
sendToInRangeSet( ActorControlPacket142( m_id, SetStatus, static_cast< uint8_t >( ActorStatus::Dead ) ), selfNeedsUpdate );
|
FFXIVPacketBasePtr packet
|
||||||
|
= boost::make_shared< ActorControlPacket142 >( m_id, SetStatus, static_cast< uint8_t >( ActorStatus::Dead ) );
|
||||||
|
sendToInRangeSet( packet, selfNeedsUpdate );
|
||||||
|
|
||||||
// TODO: not all actor show the death animation when they die, some quest npcs might just despawn
|
// TODO: not all actor show the death animation when they die, some quest npcs might just despawn
|
||||||
// although that might be handled by setting the HP to 1 and doing some script magic
|
// although that might be handled by setting the HP to 1 and doing some script magic
|
||||||
sendToInRangeSet( ActorControlPacket142( m_id, DeathAnimation, 0, 0, 0, 0x20 ), selfNeedsUpdate );
|
|
||||||
|
FFXIVPacketBasePtr packet1
|
||||||
|
= boost::make_shared< ActorControlPacket142 >( m_id, DeathAnimation, 0, 0, 0, 0x20 );
|
||||||
|
sendToInRangeSet( packet1, selfNeedsUpdate );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +254,8 @@ void Core::Entity::Chara::setStance( Stance stance )
|
||||||
{
|
{
|
||||||
m_currentStance = stance;
|
m_currentStance = stance;
|
||||||
|
|
||||||
sendToInRangeSet( ActorControlPacket142( m_id, ToggleAggro, stance, 1 ) );
|
FFXIVPacketBasePtr packet = boost::make_shared< ActorControlPacket142 >( m_id, ToggleAggro, stance, 1 );
|
||||||
|
sendToInRangeSet( packet );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -278,7 +285,8 @@ Change the current target and propagate to in range players
|
||||||
void Core::Entity::Chara::changeTarget( uint64_t targetId )
|
void Core::Entity::Chara::changeTarget( uint64_t targetId )
|
||||||
{
|
{
|
||||||
setTargetId( targetId );
|
setTargetId( targetId );
|
||||||
sendToInRangeSet( ActorControlPacket144( m_id, SetTarget, 0, 0, 0, 0, targetId ) );
|
FFXIVPacketBasePtr packet = boost::make_shared< ActorControlPacket144 >( m_id, SetTarget, 0, 0, 0, 0, targetId );
|
||||||
|
sendToInRangeSet( packet );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -349,8 +357,8 @@ so players can have their own version and we can abolish the param.
|
||||||
*/
|
*/
|
||||||
void Core::Entity::Chara::sendStatusUpdate( bool toSelf )
|
void Core::Entity::Chara::sendStatusUpdate( bool toSelf )
|
||||||
{
|
{
|
||||||
UpdateHpMpTpPacket updateHpPacket( *this );
|
FFXIVPacketBasePtr packet = boost::make_shared< UpdateHpMpTpPacket >( *this );
|
||||||
sendToInRangeSet( updateHpPacket );
|
sendToInRangeSet( packet );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \return ActionPtr of the currently registered action, or nullptr */
|
/*! \return ActionPtr of the currently registered action, or nullptr */
|
||||||
|
@ -388,24 +396,25 @@ void Core::Entity::Chara::autoAttack( CharaPtr pTarget )
|
||||||
uint16_t damage = static_cast< uint16_t >( 10 + rand() % 12 );
|
uint16_t damage = static_cast< uint16_t >( 10 + rand() % 12 );
|
||||||
uint32_t variation = static_cast< uint32_t >( 0 + rand() % 4 );
|
uint32_t variation = static_cast< uint32_t >( 0 + rand() % 4 );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcEffect > effectPacket( getId() );
|
FFXIVPacketBasePtr packet = boost::make_shared< ZoneChannelPacket< FFXIVIpcEffect > >( getId() );
|
||||||
effectPacket.data().targetId = pTarget->getId();
|
auto ipcEffect = dynamic_cast< ZoneChannelPacket< FFXIVIpcEffect >& >( *packet );
|
||||||
effectPacket.data().actionAnimationId = 0x366;
|
ipcEffect.data().targetId = pTarget->getId();
|
||||||
effectPacket.data().unknown_2 = variation;
|
ipcEffect.data().actionAnimationId = 0x366;
|
||||||
|
ipcEffect.data().unknown_2 = variation;
|
||||||
// effectPacket.data().unknown_3 = 1;
|
// effectPacket.data().unknown_3 = 1;
|
||||||
effectPacket.data().actionTextId = 0x366;
|
ipcEffect.data().actionTextId = 0x366;
|
||||||
effectPacket.data().numEffects = 1;
|
ipcEffect.data().numEffects = 1;
|
||||||
effectPacket.data().rotation = Math::Util::floatToUInt16Rot( getRot() );
|
ipcEffect.data().rotation = Math::Util::floatToUInt16Rot( getRot() );
|
||||||
effectPacket.data().effectTarget = pTarget->getId();
|
ipcEffect.data().effectTarget = pTarget->getId();
|
||||||
effectPacket.data().effects[0].value = damage;
|
ipcEffect.data().effects[0].value = damage;
|
||||||
effectPacket.data().effects[0].effectType = ActionEffectType::Damage;
|
ipcEffect.data().effects[0].effectType = ActionEffectType::Damage;
|
||||||
effectPacket.data().effects[0].hitSeverity = static_cast< ActionHitSeverityType >( variation );
|
ipcEffect.data().effects[0].hitSeverity = static_cast< ActionHitSeverityType >( variation );
|
||||||
effectPacket.data().effects[0].unknown_3 = 7;
|
ipcEffect.data().effects[0].unknown_3 = 7;
|
||||||
|
|
||||||
sendToInRangeSet( effectPacket );
|
sendToInRangeSet( packet );
|
||||||
|
|
||||||
if( isPlayer() )
|
if( isPlayer() )
|
||||||
getAsPlayer()->queuePacket( effectPacket );
|
getAsPlayer()->queuePacket( packet );
|
||||||
|
|
||||||
pTarget->takeDamage( damage );
|
pTarget->takeDamage( damage );
|
||||||
}
|
}
|
||||||
|
@ -432,7 +441,8 @@ void Core::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionId, u
|
||||||
// Todo: Effect packet generator. 90% of this is basically setting params and it's basically unreadable.
|
// Todo: Effect packet generator. 90% of this is basically setting params and it's basically unreadable.
|
||||||
// Prepare packet. This is seemingly common for all packets in the action handler.
|
// Prepare packet. This is seemingly common for all packets in the action handler.
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcEffect > effectPacket( getId() );
|
FFXIVPacketBasePtr packet = boost::make_shared< ZoneChannelPacket< FFXIVIpcEffect > >( getId() );
|
||||||
|
auto effectPacket = dynamic_cast< ZoneChannelPacket< FFXIVIpcEffect >& >( *packet );
|
||||||
effectPacket.data().targetId = target.getId();
|
effectPacket.data().targetId = target.getId();
|
||||||
effectPacket.data().actionAnimationId = actionId;
|
effectPacket.data().actionAnimationId = actionId;
|
||||||
effectPacket.data().unknown_62 = 1; // Affects displaying action name next to number in floating text
|
effectPacket.data().unknown_62 = 1; // Affects displaying action name next to number in floating text
|
||||||
|
@ -459,7 +469,7 @@ void Core::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionId, u
|
||||||
if ( isPlayer() && !ActionCollision::isActorApplicable( target, TargetFilter::Enemies ) )
|
if ( isPlayer() && !ActionCollision::isActorApplicable( target, TargetFilter::Enemies ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
sendToInRangeSet( effectPacket, true );
|
sendToInRangeSet( packet, true );
|
||||||
|
|
||||||
if ( target.isAlive() )
|
if ( target.isAlive() )
|
||||||
target.onActionHostile( *this );
|
target.onActionHostile( *this );
|
||||||
|
@ -479,7 +489,7 @@ void Core::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionId, u
|
||||||
effectPacket.data().effectTarget = pHitActor->getId();
|
effectPacket.data().effectTarget = pHitActor->getId();
|
||||||
|
|
||||||
// todo: send to range of what? ourselves? when mob script hits this is going to be lacking
|
// todo: send to range of what? ourselves? when mob script hits this is going to be lacking
|
||||||
sendToInRangeSet( effectPacket, true );
|
sendToInRangeSet( packet, true );
|
||||||
|
|
||||||
|
|
||||||
if( pHitActor->getAsChara()->isAlive() )
|
if( pHitActor->getAsChara()->isAlive() )
|
||||||
|
@ -515,7 +525,7 @@ void Core::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionId, u
|
||||||
if( isPlayer() && !ActionCollision::isActorApplicable( target, TargetFilter::Allies ) )
|
if( isPlayer() && !ActionCollision::isActorApplicable( target, TargetFilter::Allies ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
sendToInRangeSet( effectPacket, true );
|
sendToInRangeSet( packet, true );
|
||||||
target.heal( calculatedHeal );
|
target.heal( calculatedHeal );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -531,7 +541,7 @@ void Core::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionId, u
|
||||||
effectPacket.data().targetId = target.getId();
|
effectPacket.data().targetId = target.getId();
|
||||||
effectPacket.data().effectTarget = pHitActor->getId();
|
effectPacket.data().effectTarget = pHitActor->getId();
|
||||||
|
|
||||||
sendToInRangeSet( effectPacket, true );
|
sendToInRangeSet( packet, true );
|
||||||
pHitActor->getAsChara()->heal( calculatedHeal );
|
pHitActor->getAsChara()->heal( calculatedHeal );
|
||||||
|
|
||||||
// Debug
|
// Debug
|
||||||
|
@ -564,7 +574,9 @@ void Core::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEffect
|
||||||
pEffect->applyStatus();
|
pEffect->applyStatus();
|
||||||
m_statusEffectMap[nextSlot] = pEffect;
|
m_statusEffectMap[nextSlot] = pEffect;
|
||||||
|
|
||||||
ZoneChannelPacket< Server::FFXIVIpcAddStatusEffect > statusEffectAdd( getId() );
|
FFXIVPacketBasePtr packet = boost::make_shared< ZoneChannelPacket< FFXIVIpcAddStatusEffect > >( getId() );
|
||||||
|
auto statusEffectAdd = dynamic_cast< ZoneChannelPacket< FFXIVIpcAddStatusEffect >& >( *packet );
|
||||||
|
|
||||||
statusEffectAdd.data().actor_id = pEffect->getTargetActorId();
|
statusEffectAdd.data().actor_id = pEffect->getTargetActorId();
|
||||||
statusEffectAdd.data().actor_id1 = pEffect->getSrcActorId();
|
statusEffectAdd.data().actor_id1 = pEffect->getSrcActorId();
|
||||||
statusEffectAdd.data().current_hp = getHp();
|
statusEffectAdd.data().current_hp = getHp();
|
||||||
|
@ -579,7 +591,7 @@ void Core::Entity::Chara::addStatusEffect( StatusEffect::StatusEffectPtr pEffect
|
||||||
//statusEffectAdd.data().unknown2 = 28;
|
//statusEffectAdd.data().unknown2 = 28;
|
||||||
statusEffectAdd.data().param = pEffect->getParam();
|
statusEffectAdd.data().param = pEffect->getParam();
|
||||||
|
|
||||||
sendToInRangeSet( statusEffectAdd, isPlayer() );
|
sendToInRangeSet( packet, isPlayer() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \param StatusEffectPtr to be applied to the actor */
|
/*! \param StatusEffectPtr to be applied to the actor */
|
||||||
|
@ -643,7 +655,7 @@ void Core::Entity::Chara::removeStatusEffect( uint8_t effectSlotId )
|
||||||
auto pEffect = pEffectIt->second;
|
auto pEffect = pEffectIt->second;
|
||||||
pEffect->removeStatus();
|
pEffect->removeStatus();
|
||||||
|
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), StatusEffectLose, pEffect->getId() ), isPlayer() );
|
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), StatusEffectLose, pEffect->getId() ), isPlayer() );
|
||||||
|
|
||||||
m_statusEffectMap.erase( effectSlotId );
|
m_statusEffectMap.erase( effectSlotId );
|
||||||
|
|
||||||
|
@ -659,24 +671,23 @@ void Core::Entity::Chara::sendStatusEffectUpdate()
|
||||||
{
|
{
|
||||||
uint64_t currentTimeMs = Util::getTimeMs();
|
uint64_t currentTimeMs = Util::getTimeMs();
|
||||||
|
|
||||||
ZoneChannelPacket< Server::FFXIVIpcStatusEffectList > statusEffectList( getId() );
|
auto statusEffectList = boost::make_shared< ZoneChannelPacket< FFXIVIpcStatusEffectList > >( getId() );
|
||||||
|
statusEffectList->data().classId = static_cast< uint8_t >( getClass() );
|
||||||
statusEffectList.data().classId = static_cast< uint8_t >( getClass() );
|
statusEffectList->data().level = getLevel();
|
||||||
statusEffectList.data().level = getLevel();
|
statusEffectList->data().level1 = getLevel();
|
||||||
statusEffectList.data().level1 = getLevel();
|
statusEffectList->data().current_hp = getHp();
|
||||||
statusEffectList.data().current_hp = getHp();
|
statusEffectList->data().current_mp = getMp();
|
||||||
statusEffectList.data().current_mp = getMp();
|
statusEffectList->data().currentTp = getTp();
|
||||||
statusEffectList.data().currentTp = getTp();
|
statusEffectList->data().max_hp = getMaxHp();
|
||||||
statusEffectList.data().max_hp = getMaxHp();
|
statusEffectList->data().max_mp = getMaxMp();
|
||||||
statusEffectList.data().max_mp = getMaxMp();
|
|
||||||
uint8_t slot = 0;
|
uint8_t slot = 0;
|
||||||
for( auto effectIt : m_statusEffectMap )
|
for( auto effectIt : m_statusEffectMap )
|
||||||
{
|
{
|
||||||
float timeLeft = static_cast< float >( effectIt.second->getDuration() -
|
float timeLeft = static_cast< float >( effectIt.second->getDuration() -
|
||||||
( currentTimeMs - effectIt.second->getStartTimeMs() ) ) / 1000;
|
( currentTimeMs - effectIt.second->getStartTimeMs() ) ) / 1000;
|
||||||
statusEffectList.data().effect[slot].duration = timeLeft;
|
statusEffectList->data().effect[slot].duration = timeLeft;
|
||||||
statusEffectList.data().effect[slot].effect_id = effectIt.second->getId();
|
statusEffectList->data().effect[slot].effect_id = effectIt.second->getId();
|
||||||
statusEffectList.data().effect[slot].sourceActorId = effectIt.second->getSrcActorId();
|
statusEffectList->data().effect[slot].sourceActorId = effectIt.second->getSrcActorId();
|
||||||
slot++;
|
slot++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,13 +750,15 @@ void Core::Entity::Chara::updateStatusEffects()
|
||||||
if( thisTickDmg != 0 )
|
if( thisTickDmg != 0 )
|
||||||
{
|
{
|
||||||
takeDamage( thisTickDmg );
|
takeDamage( thisTickDmg );
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), HPFloatingText, 0, static_cast< uint8_t >( ActionEffectType::Damage ), thisTickDmg ) );
|
sendToInRangeSet(
|
||||||
|
boost::make_shared< ActorControlPacket142 >( getId(), HPFloatingText, 0, static_cast< uint8_t >( ActionEffectType::Damage ), thisTickDmg ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( thisTickHeal != 0 )
|
if( thisTickHeal != 0 )
|
||||||
{
|
{
|
||||||
heal( thisTickDmg );
|
heal( thisTickDmg );
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), HPFloatingText, 0, static_cast< uint8_t >( ActionEffectType::Heal ), thisTickHeal ) );
|
sendToInRangeSet(
|
||||||
|
boost::make_shared< ActorControlPacket142 >( getId(), HPFloatingText, 0, static_cast< uint8_t >( ActionEffectType::Heal ), thisTickHeal ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,23 +78,27 @@ void Core::Entity::EventObject::setState( uint8_t state )
|
||||||
|
|
||||||
for( const auto& player : m_inRangePlayers )
|
for( const auto& player : m_inRangePlayers )
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcActorControl142 > eobjUpdatePacket( getId(), player->getId() );
|
FFXIVPacketBasePtr packet = boost::make_shared< ZoneChannelPacket< FFXIVIpcActorControl142 > >( getId(), player->getId() );
|
||||||
|
auto eobjUpdatePacket = dynamic_cast< ZoneChannelPacket< FFXIVIpcActorControl142 >& >( *packet );
|
||||||
|
|
||||||
eobjUpdatePacket.data().category = Common::ActorControlType::DirectorEObjMod;
|
eobjUpdatePacket.data().category = Common::ActorControlType::DirectorEObjMod;
|
||||||
eobjUpdatePacket.data().param1 = state;
|
eobjUpdatePacket.data().param1 = state;
|
||||||
|
|
||||||
player->queuePacket( eobjUpdatePacket );
|
player->queuePacket( packet );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::EventObject::setAnimationFlag( uint32_t flag, uint32_t animationFlag ) {
|
void Core::Entity::EventObject::setAnimationFlag( uint32_t flag, uint32_t animationFlag ) {
|
||||||
for( const auto& player : m_inRangePlayers )
|
for( const auto& player : m_inRangePlayers )
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcActorControl142 > eobjUpdatePacket( getId(), player->getId() );
|
FFXIVPacketBasePtr packet = boost::make_shared< ZoneChannelPacket< FFXIVIpcActorControl142 > >( getId(), player->getId() );
|
||||||
|
auto eobjUpdatePacket = dynamic_cast< ZoneChannelPacket< FFXIVIpcActorControl142 >& >( *packet );
|
||||||
|
|
||||||
eobjUpdatePacket.data().category = Common::ActorControlType::EObjAnimation;
|
eobjUpdatePacket.data().category = Common::ActorControlType::EObjAnimation;
|
||||||
eobjUpdatePacket.data().param1 = flag;
|
eobjUpdatePacket.data().param1 = flag;
|
||||||
eobjUpdatePacket.data().param2 = animationFlag;
|
eobjUpdatePacket.data().param2 = animationFlag;
|
||||||
|
|
||||||
player->queuePacket( eobjUpdatePacket );
|
player->queuePacket( packet );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +121,10 @@ void Core::Entity::EventObject::spawn( Core::Entity::PlayerPtr pTarget )
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = g_fw.get< Logger >();
|
||||||
|
|
||||||
pLog->debug( "Spawning EObj: id:" + std::to_string( getId() ) + " name:" + getName() );
|
pLog->debug( "Spawning EObj: id:" + std::to_string( getId() ) + " name:" + getName() );
|
||||||
ZoneChannelPacket< FFXIVIpcObjectSpawn > eobjStatePacket( getId(), pTarget->getId() );
|
|
||||||
|
FFXIVPacketBasePtr packet = boost::make_shared< ZoneChannelPacket< FFXIVIpcObjectSpawn > >( getId(), pTarget->getId() );
|
||||||
|
auto eobjStatePacket = dynamic_cast< ZoneChannelPacket< FFXIVIpcObjectSpawn >& >( *packet );
|
||||||
|
|
||||||
eobjStatePacket.data().spawnIndex = spawnIndex;
|
eobjStatePacket.data().spawnIndex = spawnIndex;
|
||||||
eobjStatePacket.data().objKind = getObjKind();
|
eobjStatePacket.data().objKind = getObjKind();
|
||||||
eobjStatePacket.data().state = getState();
|
eobjStatePacket.data().state = getState();
|
||||||
|
@ -127,7 +134,7 @@ void Core::Entity::EventObject::spawn( Core::Entity::PlayerPtr pTarget )
|
||||||
eobjStatePacket.data().scale = getScale();
|
eobjStatePacket.data().scale = getScale();
|
||||||
eobjStatePacket.data().actorId = getId();
|
eobjStatePacket.data().actorId = getId();
|
||||||
eobjStatePacket.data().rotation = Math::Util::floatToUInt16Rot( getRot() );
|
eobjStatePacket.data().rotation = Math::Util::floatToUInt16Rot( getRot() );
|
||||||
pTarget->queuePacket( eobjStatePacket );
|
pTarget->queuePacket( packet );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -204,12 +204,14 @@ uint64_t Core::Entity::Player::getOnlineStatusMask() const
|
||||||
|
|
||||||
void Core::Entity::Player::prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadeOutTime, uint16_t animation )
|
void Core::Entity::Player::prepareZoning( uint16_t targetZone, bool fadeOut, uint8_t fadeOutTime, uint16_t animation )
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcPrepareZoning > preparePacket( getId() );
|
FFXIVPacketBasePtr packet = boost::make_shared< ZoneChannelPacket< FFXIVIpcPrepareZoning > >( getId() );
|
||||||
|
auto preparePacket = dynamic_cast< ZoneChannelPacket< FFXIVIpcPrepareZoning >& >( *packet );
|
||||||
|
|
||||||
preparePacket.data().targetZone = targetZone;
|
preparePacket.data().targetZone = targetZone;
|
||||||
preparePacket.data().fadeOutTime = fadeOutTime;
|
preparePacket.data().fadeOutTime = fadeOutTime;
|
||||||
preparePacket.data().animation = animation;
|
preparePacket.data().animation = animation;
|
||||||
preparePacket.data().fadeOut = static_cast< uint8_t >( fadeOut ? 1 : 0 );
|
preparePacket.data().fadeOut = static_cast< uint8_t >( fadeOut ? 1 : 0 );
|
||||||
queuePacket( preparePacket );
|
queuePacket( packet );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::calculateStats()
|
void Core::Entity::Player::calculateStats()
|
||||||
|
@ -271,29 +273,30 @@ bool Core::Entity::Player::isAutoattackOn() const
|
||||||
|
|
||||||
void Core::Entity::Player::sendStats()
|
void Core::Entity::Player::sendStats()
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcPlayerStats > statPacket( getId() );
|
|
||||||
statPacket.data().strength = m_baseStats.str;
|
|
||||||
statPacket.data().dexterity = m_baseStats.dex;
|
|
||||||
statPacket.data().vitality = m_baseStats.vit;
|
|
||||||
statPacket.data().intelligence = m_baseStats.inte;
|
|
||||||
statPacket.data().mind = m_baseStats.mnd;
|
|
||||||
statPacket.data().piety = m_baseStats.pie;
|
|
||||||
statPacket.data().determination = m_baseStats.determination;
|
|
||||||
statPacket.data().hp = m_baseStats.max_hp;
|
|
||||||
statPacket.data().mp = m_baseStats.max_mp;
|
|
||||||
statPacket.data().accuracy = m_baseStats.accuracy;
|
|
||||||
statPacket.data().attack = m_baseStats.attack;
|
|
||||||
statPacket.data().attackMagicPotency = m_baseStats.attackPotMagic;
|
|
||||||
statPacket.data().healingMagicPotency = m_baseStats.healingPotMagic;
|
|
||||||
statPacket.data().skillSpeed = m_baseStats.skillSpeed;
|
|
||||||
statPacket.data().spellSpeed = m_baseStats.spellSpeed;
|
|
||||||
statPacket.data().spellSpeed1 = m_baseStats.spellSpeed;
|
|
||||||
statPacket.data().spellSpeedMod = 100;
|
|
||||||
|
|
||||||
statPacket.data().criticalHitRate = m_baseStats.spellSpeed;
|
auto statPacket = makeZonePacket< FFXIVIpcPlayerStats >( getId() );
|
||||||
statPacket.data().defense = m_baseStats.spellSpeed;
|
statPacket->data().strength = m_baseStats.str;
|
||||||
statPacket.data().magicDefense = m_baseStats.spellSpeed;
|
statPacket->data().dexterity = m_baseStats.dex;
|
||||||
statPacket.data().attack = m_baseStats.spellSpeed;
|
statPacket->data().vitality = m_baseStats.vit;
|
||||||
|
statPacket->data().intelligence = m_baseStats.inte;
|
||||||
|
statPacket->data().mind = m_baseStats.mnd;
|
||||||
|
statPacket->data().piety = m_baseStats.pie;
|
||||||
|
statPacket->data().determination = m_baseStats.determination;
|
||||||
|
statPacket->data().hp = m_baseStats.max_hp;
|
||||||
|
statPacket->data().mp = m_baseStats.max_mp;
|
||||||
|
statPacket->data().accuracy = m_baseStats.accuracy;
|
||||||
|
statPacket->data().attack = m_baseStats.attack;
|
||||||
|
statPacket->data().attackMagicPotency = m_baseStats.attackPotMagic;
|
||||||
|
statPacket->data().healingMagicPotency = m_baseStats.healingPotMagic;
|
||||||
|
statPacket->data().skillSpeed = m_baseStats.skillSpeed;
|
||||||
|
statPacket->data().spellSpeed = m_baseStats.spellSpeed;
|
||||||
|
statPacket->data().spellSpeed1 = m_baseStats.spellSpeed;
|
||||||
|
statPacket->data().spellSpeedMod = 100;
|
||||||
|
|
||||||
|
statPacket->data().criticalHitRate = m_baseStats.spellSpeed;
|
||||||
|
statPacket->data().defense = m_baseStats.spellSpeed;
|
||||||
|
statPacket->data().magicDefense = m_baseStats.spellSpeed;
|
||||||
|
statPacket->data().attack = m_baseStats.spellSpeed;
|
||||||
|
|
||||||
queuePacket( statPacket );
|
queuePacket( statPacket );
|
||||||
}
|
}
|
||||||
|
@ -333,19 +336,19 @@ void Core::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
|
||||||
if( type == 1 ) // teleport
|
if( type == 1 ) // teleport
|
||||||
{
|
{
|
||||||
prepareZoning( data->territory, true, 1, 112 ); // TODO: Really?
|
prepareZoning( data->territory, true, 1, 112 ); // TODO: Really?
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), ActorDespawnEffect, 0x04 ) );
|
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), ActorDespawnEffect, 0x04 ) );
|
||||||
setZoningType( Common::ZoneingType::Teleport );
|
setZoningType( Common::ZoneingType::Teleport );
|
||||||
}
|
}
|
||||||
else if( type == 2 ) // aethernet
|
else if( type == 2 ) // aethernet
|
||||||
{
|
{
|
||||||
prepareZoning( data->territory, true, 1, 112 );
|
prepareZoning( data->territory, true, 1, 112 );
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), ActorDespawnEffect, 0x04 ) );
|
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), ActorDespawnEffect, 0x04 ) );
|
||||||
setZoningType( Common::ZoneingType::Teleport );
|
setZoningType( Common::ZoneingType::Teleport );
|
||||||
}
|
}
|
||||||
else if( type == 3 ) // return
|
else if( type == 3 ) // return
|
||||||
{
|
{
|
||||||
prepareZoning( data->territory, true, 1, 111 );
|
prepareZoning( data->territory, true, 1, 111 );
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), ActorDespawnEffect, 0x03 ) );
|
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), ActorDespawnEffect, 0x03 ) );
|
||||||
setZoningType( Common::ZoneingType::Return );
|
setZoningType( Common::ZoneingType::Return );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,7 +474,7 @@ void Core::Entity::Player::registerAetheryte( uint8_t aetheryteId )
|
||||||
Util::valueToFlagByteIndexValue( aetheryteId, value, index );
|
Util::valueToFlagByteIndexValue( aetheryteId, value, index );
|
||||||
|
|
||||||
m_aetheryte[index] |= value;
|
m_aetheryte[index] |= value;
|
||||||
queuePacket( ActorControlPacket143( getId(), LearnTeleport, aetheryteId, 1 ) );
|
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), LearnTeleport, aetheryteId, 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Core::Entity::Player::isAetheryteRegistered( uint8_t aetheryteId ) const
|
bool Core::Entity::Player::isAetheryteRegistered( uint8_t aetheryteId ) const
|
||||||
|
@ -562,7 +565,7 @@ void Core::Entity::Player::learnAction( uint8_t actionId )
|
||||||
|
|
||||||
m_unlocks[index] |= value;
|
m_unlocks[index] |= value;
|
||||||
|
|
||||||
queuePacket( ActorControlPacket143( getId(), ToggleActionUnlock, actionId, 1 ) );
|
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), ToggleActionUnlock, actionId, 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::learnSong( uint8_t songId, uint32_t itemId )
|
void Core::Entity::Player::learnSong( uint8_t songId, uint32_t itemId )
|
||||||
|
@ -573,7 +576,7 @@ void Core::Entity::Player::learnSong( uint8_t songId, uint32_t itemId )
|
||||||
|
|
||||||
m_orchestrion[index] |= value;
|
m_orchestrion[index] |= value;
|
||||||
|
|
||||||
queuePacket( ActorControlPacket143( getId(), ToggleOrchestrionUnlock, songId, 1, itemId ) );
|
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), ToggleOrchestrionUnlock, songId, 1, itemId ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Core::Entity::Player::isActionLearned( uint8_t actionId ) const
|
bool Core::Entity::Player::isActionLearned( uint8_t actionId ) const
|
||||||
|
@ -597,11 +600,11 @@ void Core::Entity::Player::gainExp( uint32_t amount )
|
||||||
|
|
||||||
uint32_t neededExpToLevelplus1 = pExdData->get< Core::Data::ParamGrow >( level + 1 )->expToNext;
|
uint32_t neededExpToLevelplus1 = pExdData->get< Core::Data::ParamGrow >( level + 1 )->expToNext;
|
||||||
|
|
||||||
queuePacket( ActorControlPacket143( getId(), GainExpMsg, static_cast< uint8_t >( getClass() ), amount ) );
|
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), GainExpMsg, static_cast< uint8_t >( getClass() ), amount ) );
|
||||||
|
|
||||||
if( level >= 70 ) // temporary fix for leveling over levelcap
|
if( level >= 70 ) // temporary fix for leveling over levelcap
|
||||||
{
|
{
|
||||||
queuePacket( ActorControlPacket143( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), amount ) );
|
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), amount ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,12 +616,12 @@ void Core::Entity::Player::gainExp( uint32_t amount )
|
||||||
( currentExp + amount - neededExpToLevel );
|
( currentExp + amount - neededExpToLevel );
|
||||||
setExp( amount );
|
setExp( amount );
|
||||||
gainLevel();
|
gainLevel();
|
||||||
queuePacket( ActorControlPacket143( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), amount ) );
|
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), amount ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
queuePacket( ActorControlPacket143( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), currentExp + amount ) );
|
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), UpdateUiExp, static_cast< uint8_t >( getClass() ), currentExp + amount ) );
|
||||||
setExp( currentExp + amount );
|
setExp( currentExp + amount );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,34 +639,33 @@ void Core::Entity::Player::gainLevel()
|
||||||
m_hp = getMaxHp();
|
m_hp = getMaxHp();
|
||||||
m_mp = getMaxMp();
|
m_mp = getMaxMp();
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcStatusEffectList > effectListPacket( getId() );
|
auto effectListPacket = makeZonePacket< FFXIVIpcStatusEffectList >( getId() );
|
||||||
effectListPacket.data().classId = static_cast< uint8_t > ( getClass() );
|
effectListPacket->data().classId = static_cast< uint8_t > ( getClass() );
|
||||||
effectListPacket.data().level1 = getLevel();
|
effectListPacket->data().level1 = getLevel();
|
||||||
effectListPacket.data().level = getLevel();
|
effectListPacket->data().level = getLevel();
|
||||||
effectListPacket.data().current_hp = getMaxHp();
|
effectListPacket->data().current_hp = getMaxHp();
|
||||||
effectListPacket.data().current_mp = getMaxMp();
|
effectListPacket->data().current_mp = getMaxMp();
|
||||||
effectListPacket.data().currentTp = 1000;
|
effectListPacket->data().currentTp = 1000;
|
||||||
effectListPacket.data().max_hp = getMaxHp();
|
effectListPacket->data().max_hp = getMaxHp();
|
||||||
effectListPacket.data().max_mp = getMaxMp();
|
effectListPacket->data().max_mp = getMaxMp();
|
||||||
sendToInRangeSet( effectListPacket, true );
|
sendToInRangeSet( effectListPacket, true );
|
||||||
|
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), LevelUpEffect, static_cast< uint8_t >( getClass() ),
|
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), LevelUpEffect, static_cast< uint8_t >( getClass() ),
|
||||||
getLevel(), getLevel() - 1 ), true );
|
getLevel(), getLevel() - 1 ), true );
|
||||||
|
|
||||||
|
auto classInfoPacket = makeZonePacket< FFXIVIpcUpdateClassInfo >( getId() );
|
||||||
ZoneChannelPacket< FFXIVIpcUpdateClassInfo > classInfoPacket( getId() );
|
classInfoPacket->data().classId = static_cast< uint8_t > ( getClass() );
|
||||||
classInfoPacket.data().classId = static_cast< uint8_t > ( getClass() );
|
classInfoPacket->data().level1 = getLevel();
|
||||||
classInfoPacket.data().level1 = getLevel();
|
classInfoPacket->data().level = getLevel();
|
||||||
classInfoPacket.data().level = getLevel();
|
classInfoPacket->data().nextLevelIndex = getLevel();
|
||||||
classInfoPacket.data().nextLevelIndex = getLevel();
|
classInfoPacket->data().currentExp = getExp();
|
||||||
classInfoPacket.data().currentExp = getExp();
|
|
||||||
queuePacket( classInfoPacket );
|
queuePacket( classInfoPacket );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::sendStatusUpdate( bool toSelf )
|
void Core::Entity::Player::sendStatusUpdate( bool toSelf )
|
||||||
{
|
{
|
||||||
sendToInRangeSet( UpdateHpMpTpPacket( *this ), true );
|
sendToInRangeSet( boost::make_shared< UpdateHpMpTpPacket >( *this ), true );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Core::Entity::Player::getLevel() const
|
uint8_t Core::Entity::Player::getLevel() const
|
||||||
|
@ -717,12 +719,12 @@ void Core::Entity::Player::setClassJob( Common::ClassJob classJob )
|
||||||
|
|
||||||
m_tp = 0;
|
m_tp = 0;
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcPlayerClassInfo > classInfoPacket( getId() );
|
auto classInfoPacket = makeZonePacket< FFXIVIpcPlayerClassInfo >( getId() );
|
||||||
classInfoPacket.data().classId = static_cast< uint8_t >( getClass() );
|
classInfoPacket->data().classId = static_cast< uint8_t >( getClass() );
|
||||||
classInfoPacket.data().level = getLevel();
|
classInfoPacket->data().level = getLevel();
|
||||||
queuePacket( classInfoPacket );
|
queuePacket( classInfoPacket );
|
||||||
|
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), ClassJobChange, 0x04 ), true );
|
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), ClassJobChange, 0x04 ), true );
|
||||||
|
|
||||||
sendStatusUpdate( true );
|
sendStatusUpdate( true );
|
||||||
}
|
}
|
||||||
|
@ -747,8 +749,7 @@ void Core::Entity::Player::setLevelForClass( uint8_t level, Common::ClassJob cla
|
||||||
|
|
||||||
void Core::Entity::Player::sendModel()
|
void Core::Entity::Player::sendModel()
|
||||||
{
|
{
|
||||||
ModelEquipPacket modelEquip( *getAsPlayer() );
|
sendToInRangeSet( boost::make_shared< ModelEquipPacket >( *getAsPlayer() ), true );
|
||||||
sendToInRangeSet( modelEquip, true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Core::Entity::Player::getModelForSlot( Inventory::EquipSlot slot )
|
uint32_t Core::Entity::Player::getModelForSlot( Inventory::EquipSlot slot )
|
||||||
|
@ -816,8 +817,7 @@ void Core::Entity::Player::spawn( Entity::PlayerPtr pTarget )
|
||||||
getName() + " for " +
|
getName() + " for " +
|
||||||
pTarget->getName() );
|
pTarget->getName() );
|
||||||
|
|
||||||
PlayerSpawnPacket spawnActor( *getAsPlayer(), *pTarget );
|
pTarget->queuePacket( boost::make_shared< PlayerSpawnPacket >( *getAsPlayer(), *pTarget ) );
|
||||||
pTarget->queuePacket( spawnActor );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// despawn
|
// despawn
|
||||||
|
@ -829,7 +829,7 @@ void Core::Entity::Player::despawn( Entity::PlayerPtr pTarget )
|
||||||
|
|
||||||
pPlayer->freePlayerSpawnId( getId() );
|
pPlayer->freePlayerSpawnId( getId() );
|
||||||
|
|
||||||
pPlayer->queuePacket( ActorControlPacket143( getId(), DespawnZoneScreenMsg, 0x04, getId(), 0x01 ) );
|
pPlayer->queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), DespawnZoneScreenMsg, 0x04, getId(), 0x01 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Entity::ActorPtr Core::Entity::Player::lookupTargetById( uint64_t targetId )
|
Core::Entity::ActorPtr Core::Entity::Player::lookupTargetById( uint64_t targetId )
|
||||||
|
@ -863,11 +863,11 @@ void Core::Entity::Player::setGc( uint8_t gc )
|
||||||
{
|
{
|
||||||
m_gc = gc;
|
m_gc = gc;
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVGCAffiliation > gcAffPacket( getId() );
|
auto gcAffPacket = makeZonePacket< FFXIVGCAffiliation >( getId() );
|
||||||
gcAffPacket.data().gcId = m_gc;
|
gcAffPacket->data().gcId = m_gc;
|
||||||
gcAffPacket.data().gcRank[0] = m_gcRank[0];
|
gcAffPacket->data().gcRank[0] = m_gcRank[0];
|
||||||
gcAffPacket.data().gcRank[1] = m_gcRank[1];
|
gcAffPacket->data().gcRank[1] = m_gcRank[1];
|
||||||
gcAffPacket.data().gcRank[2] = m_gcRank[2];
|
gcAffPacket->data().gcRank[2] = m_gcRank[2];
|
||||||
queuePacket( gcAffPacket );
|
queuePacket( gcAffPacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -875,11 +875,11 @@ void Core::Entity::Player::setGcRankAt( uint8_t index, uint8_t rank )
|
||||||
{
|
{
|
||||||
m_gcRank[index] = rank;
|
m_gcRank[index] = rank;
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVGCAffiliation > gcAffPacket( getId() );
|
auto gcAffPacket = makeZonePacket< FFXIVGCAffiliation >( getId() );
|
||||||
gcAffPacket.data().gcId = m_gc;
|
gcAffPacket->data().gcId = m_gc;
|
||||||
gcAffPacket.data().gcRank[0] = m_gcRank[0];
|
gcAffPacket->data().gcRank[0] = m_gcRank[0];
|
||||||
gcAffPacket.data().gcRank[1] = m_gcRank[1];
|
gcAffPacket->data().gcRank[1] = m_gcRank[1];
|
||||||
gcAffPacket.data().gcRank[2] = m_gcRank[2];
|
gcAffPacket->data().gcRank[2] = m_gcRank[2];
|
||||||
queuePacket( gcAffPacket );
|
queuePacket( gcAffPacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,8 +925,8 @@ void Core::Entity::Player::setStateFlag( Common::PlayerStateFlag flag )
|
||||||
auto newOnlineStatus = getOnlineStatus();
|
auto newOnlineStatus = getOnlineStatus();
|
||||||
|
|
||||||
if( prevOnlineStatus != newOnlineStatus )
|
if( prevOnlineStatus != newOnlineStatus )
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), SetStatusIcon,
|
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), SetStatusIcon,
|
||||||
static_cast< uint8_t >( getOnlineStatus() ) ), true );
|
static_cast< uint8_t >( getOnlineStatus() ) ), true );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -940,7 +940,7 @@ void Core::Entity::Player::setStateFlags( std::vector< Common::PlayerStateFlag >
|
||||||
|
|
||||||
void Core::Entity::Player::sendStateFlags()
|
void Core::Entity::Player::sendStateFlags()
|
||||||
{
|
{
|
||||||
queuePacket( PlayerStateFlagsPacket( *getAsPlayer() ) );
|
queuePacket( boost::make_shared< PlayerStateFlagsPacket >( *getAsPlayer() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::unsetStateFlag( Common::PlayerStateFlag flag )
|
void Core::Entity::Player::unsetStateFlag( Common::PlayerStateFlag flag )
|
||||||
|
@ -962,8 +962,8 @@ void Core::Entity::Player::unsetStateFlag( Common::PlayerStateFlag flag )
|
||||||
auto newOnlineStatus = getOnlineStatus();
|
auto newOnlineStatus = getOnlineStatus();
|
||||||
|
|
||||||
if( prevOnlineStatus != newOnlineStatus )
|
if( prevOnlineStatus != newOnlineStatus )
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), SetStatusIcon,
|
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), SetStatusIcon,
|
||||||
static_cast< uint8_t >( getOnlineStatus() ) ), true );
|
static_cast< uint8_t >( getOnlineStatus() ) ), true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::update( int64_t currTime )
|
void Core::Entity::Player::update( int64_t currTime )
|
||||||
|
@ -979,12 +979,12 @@ void Core::Entity::Player::update( int64_t currTime )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcActorSetPos > setActorPosPacket( getId() );
|
auto setActorPosPacket = makeZonePacket< FFXIVIpcActorSetPos >( getId() );
|
||||||
setActorPosPacket.data().r16 = Math::Util::floatToUInt16Rot( m_queuedZoneing->m_targetRotation );
|
setActorPosPacket->data().r16 = Math::Util::floatToUInt16Rot( m_queuedZoneing->m_targetRotation );
|
||||||
setActorPosPacket.data().waitForLoad = 0x04;
|
setActorPosPacket->data().waitForLoad = 0x04;
|
||||||
setActorPosPacket.data().x = targetPos.x;
|
setActorPosPacket->data().x = targetPos.x;
|
||||||
setActorPosPacket.data().y = targetPos.y;
|
setActorPosPacket->data().y = targetPos.y;
|
||||||
setActorPosPacket.data().z = targetPos.z;
|
setActorPosPacket->data().z = targetPos.z;
|
||||||
sendToInRangeSet( setActorPosPacket, true );
|
sendToInRangeSet( setActorPosPacket, true );
|
||||||
setPos( targetPos );
|
setPos( targetPos );
|
||||||
}
|
}
|
||||||
|
@ -1059,9 +1059,9 @@ void Core::Entity::Player::freePlayerSpawnId( uint32_t actorId )
|
||||||
{
|
{
|
||||||
auto spawnId = m_actorSpawnIndexAllocator.freeUsedSpawnIndex( actorId );
|
auto spawnId = m_actorSpawnIndexAllocator.freeUsedSpawnIndex( actorId );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcActorFreeSpawn > freeActorSpawnPacket( getId() );
|
auto freeActorSpawnPacket = makeZonePacket< FFXIVIpcActorFreeSpawn >( getId() );
|
||||||
freeActorSpawnPacket.data().actorId = actorId;
|
freeActorSpawnPacket->data().actorId = actorId;
|
||||||
freeActorSpawnPacket.data().spawnId = spawnId;
|
freeActorSpawnPacket->data().spawnId = spawnId;
|
||||||
queuePacket( freeActorSpawnPacket );
|
queuePacket( freeActorSpawnPacket );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1076,7 +1076,7 @@ void Core::Entity::Player::setHomepoint( uint8_t aetheryteId )
|
||||||
{
|
{
|
||||||
m_homePoint = aetheryteId;
|
m_homePoint = aetheryteId;
|
||||||
|
|
||||||
queuePacket( ActorControlPacket143( getId(), SetHomepoint, aetheryteId ) );
|
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), SetHomepoint, aetheryteId ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! get homepoint */
|
/*! get homepoint */
|
||||||
|
@ -1160,7 +1160,7 @@ const uint8_t* Core::Entity::Player::getGcRankArray() const
|
||||||
return m_gcRank;
|
return m_gcRank;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::queuePacket( Network::Packets::GamePacketPtr pPacket )
|
void Core::Entity::Player::queuePacket( Network::Packets::FFXIVPacketBasePtr pPacket )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerZone >();
|
auto pServerZone = g_fw.get< ServerZone >();
|
||||||
auto pSession = pServerZone->getSession( m_id );
|
auto pSession = pServerZone->getSession( m_id );
|
||||||
|
@ -1175,7 +1175,7 @@ void Core::Entity::Player::queuePacket( Network::Packets::GamePacketPtr pPacket
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::queueChatPacket( Network::Packets::GamePacketPtr pPacket )
|
void Core::Entity::Player::queueChatPacket( Network::Packets::FFXIVPacketBasePtr pPacket )
|
||||||
{
|
{
|
||||||
auto pServerZone = g_fw.get< ServerZone >();
|
auto pServerZone = g_fw.get< ServerZone >();
|
||||||
auto pSession = pServerZone->getSession( m_id );
|
auto pSession = pServerZone->getSession( m_id );
|
||||||
|
@ -1248,17 +1248,17 @@ uint8_t Core::Entity::Player::getSearchSelectClass() const
|
||||||
|
|
||||||
void Core::Entity::Player::sendNotice( const std::string& message ) //Purple Text
|
void Core::Entity::Player::sendNotice( const std::string& message ) //Purple Text
|
||||||
{
|
{
|
||||||
queuePacket( ServerNoticePacket( getId(), message ) );
|
queuePacket( boost::make_shared< ServerNoticePacket >( getId(), message ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::sendUrgent( const std::string& message ) //Red Text
|
void Core::Entity::Player::sendUrgent( const std::string& message ) //Red Text
|
||||||
{
|
{
|
||||||
queuePacket( ChatPacket( *getAsPlayer(), ChatType::ServerUrgent, message ) );
|
queuePacket( boost::make_shared< ChatPacket >( *getAsPlayer(), ChatType::ServerUrgent, message ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::sendDebug( const std::string& message ) //Grey Text
|
void Core::Entity::Player::sendDebug( const std::string& message ) //Grey Text
|
||||||
{
|
{
|
||||||
queuePacket( ChatPacket( *getAsPlayer(), ChatType::ServerDebug, message ) );
|
queuePacket( boost::make_shared< ChatPacket >( *getAsPlayer(), ChatType::ServerDebug, message ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::updateHowtosSeen( uint32_t howToId )
|
void Core::Entity::Player::updateHowtosSeen( uint32_t howToId )
|
||||||
|
@ -1280,13 +1280,13 @@ void Core::Entity::Player::initHateSlotQueue()
|
||||||
|
|
||||||
void Core::Entity::Player::sendHateList()
|
void Core::Entity::Player::sendHateList()
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcHateList > hateListPacket( getId() );
|
auto hateListPacket = makeZonePacket< FFXIVIpcHateList >( getId() );
|
||||||
hateListPacket.data().numEntries = m_actorIdTohateSlotMap.size();
|
hateListPacket->data().numEntries = m_actorIdTohateSlotMap.size();
|
||||||
auto it = m_actorIdTohateSlotMap.begin();
|
auto it = m_actorIdTohateSlotMap.begin();
|
||||||
for( int32_t i = 0; it != m_actorIdTohateSlotMap.end(); ++it, i++ )
|
for( int32_t i = 0; it != m_actorIdTohateSlotMap.end(); ++it, i++ )
|
||||||
{
|
{
|
||||||
hateListPacket.data().entry[i].actorId = it->first;
|
hateListPacket->data().entry[i].actorId = it->first;
|
||||||
hateListPacket.data().entry[i].hatePercent = 100;
|
hateListPacket->data().entry[i].hatePercent = 100;
|
||||||
}
|
}
|
||||||
queuePacket( hateListPacket );
|
queuePacket( hateListPacket );
|
||||||
}
|
}
|
||||||
|
@ -1336,14 +1336,14 @@ void Core::Entity::Player::setTitle( uint16_t titleId )
|
||||||
|
|
||||||
m_activeTitle = titleId;
|
m_activeTitle = titleId;
|
||||||
|
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), SetTitle, titleId ), true );
|
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), SetTitle, titleId ), true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::setEquipDisplayFlags( uint8_t state )
|
void Core::Entity::Player::setEquipDisplayFlags( uint8_t state )
|
||||||
{
|
{
|
||||||
m_equipDisplayFlags = state;
|
m_equipDisplayFlags = state;
|
||||||
ZoneChannelPacket< FFXIVIpcEquipDisplayFlags > paramPacket( getId() );
|
auto paramPacket = makeZonePacket< FFXIVIpcEquipDisplayFlags >( getId() );
|
||||||
paramPacket.data().bitmask = m_equipDisplayFlags;
|
paramPacket->data().bitmask = m_equipDisplayFlags;
|
||||||
sendToInRangeSet( paramPacket, true );
|
sendToInRangeSet( paramPacket, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1355,19 +1355,19 @@ uint8_t Core::Entity::Player::getEquipDisplayFlags() const
|
||||||
void Core::Entity::Player::mount( uint32_t id )
|
void Core::Entity::Player::mount( uint32_t id )
|
||||||
{
|
{
|
||||||
m_mount = id;
|
m_mount = id;
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), ActorControlType::SetStatus, static_cast< uint8_t >( Entity::Chara::ActorStatus::Mounted )), true );
|
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), ActorControlType::SetStatus, static_cast< uint8_t >( Entity::Chara::ActorStatus::Mounted )), true );
|
||||||
sendToInRangeSet( ActorControlPacket143( getId(), 0x39e, 12 ), true ); //?
|
sendToInRangeSet( boost::make_shared< ActorControlPacket143 >( getId(), 0x39e, 12 ), true ); //?
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcMount > mountPacket( getId() );
|
auto mountPacket = makeZonePacket< FFXIVIpcMount >( getId() );
|
||||||
mountPacket.data().id = id;
|
mountPacket->data().id = id;
|
||||||
sendToInRangeSet( mountPacket, true );
|
sendToInRangeSet( mountPacket, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::dismount()
|
void Core::Entity::Player::dismount()
|
||||||
{
|
{
|
||||||
sendToInRangeSet( ActorControlPacket142( getId(), ActorControlType::SetStatus,
|
sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( getId(), ActorControlType::SetStatus,
|
||||||
static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle )), true );
|
static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle )), true );
|
||||||
sendToInRangeSet( ActorControlPacket143( getId(), ActorControlType::Dismount, 1 ), true );
|
sendToInRangeSet( boost::make_shared< ActorControlPacket143 >( getId(), ActorControlType::Dismount, 1 ), true );
|
||||||
m_mount = 0;
|
m_mount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1391,41 +1391,41 @@ void Core::Entity::Player::autoAttack( CharaPtr pTarget )
|
||||||
|
|
||||||
if( getClass() == ClassJob::Machinist || getClass() == ClassJob::Bard || getClass() == ClassJob::Archer )
|
if( getClass() == ClassJob::Machinist || getClass() == ClassJob::Bard || getClass() == ClassJob::Archer )
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcEffect > effectPacket( getId() );
|
auto effectPacket = makeZonePacket< FFXIVIpcEffect >( getId() );
|
||||||
effectPacket.data().targetId = pTarget->getId();
|
effectPacket->data().targetId = pTarget->getId();
|
||||||
effectPacket.data().actionAnimationId = 8;
|
effectPacket->data().actionAnimationId = 8;
|
||||||
// effectPacket.data().unknown_2 = variation;
|
// effectPacket.data().unknown_2 = variation;
|
||||||
effectPacket.data().numEffects = 1;
|
effectPacket->data().numEffects = 1;
|
||||||
effectPacket.data().unknown_61 = 1;
|
effectPacket->data().unknown_61 = 1;
|
||||||
effectPacket.data().unknown_62 = 1;
|
effectPacket->data().unknown_62 = 1;
|
||||||
effectPacket.data().actionTextId = 8;
|
effectPacket->data().actionTextId = 8;
|
||||||
effectPacket.data().rotation = Math::Util::floatToUInt16Rot( getRot() );
|
effectPacket->data().rotation = Math::Util::floatToUInt16Rot( getRot() );
|
||||||
effectPacket.data().effectTargetId = pTarget->getId();
|
effectPacket->data().effectTargetId = pTarget->getId();
|
||||||
effectPacket.data().effectTarget = pTarget->getId();
|
effectPacket->data().effectTarget = pTarget->getId();
|
||||||
effectPacket.data().effects[0].value = damage;
|
effectPacket->data().effects[0].value = damage;
|
||||||
effectPacket.data().effects[0].effectType = Common::ActionEffectType::Damage;
|
effectPacket->data().effects[0].effectType = Common::ActionEffectType::Damage;
|
||||||
effectPacket.data().effects[0].hitSeverity = Common::ActionHitSeverityType::NormalDamage;
|
effectPacket->data().effects[0].hitSeverity = Common::ActionHitSeverityType::NormalDamage;
|
||||||
effectPacket.data().effects[0].unknown_3 = 7;
|
effectPacket->data().effects[0].unknown_3 = 7;
|
||||||
|
|
||||||
sendToInRangeSet(effectPacket, true);
|
sendToInRangeSet(effectPacket, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcEffect > effectPacket( getId() );
|
auto effectPacket = makeZonePacket< FFXIVIpcEffect >( getId() );
|
||||||
effectPacket.data().targetId = pTarget->getId();
|
effectPacket->data().targetId = pTarget->getId();
|
||||||
effectPacket.data().actionAnimationId = 7;
|
effectPacket->data().actionAnimationId = 7;
|
||||||
// effectPacket.data().unknown_2 = variation;
|
// effectPacket.data().unknown_2 = variation;
|
||||||
effectPacket.data().numEffects = 1;
|
effectPacket->data().numEffects = 1;
|
||||||
effectPacket.data().unknown_61 = 1;
|
effectPacket->data().unknown_61 = 1;
|
||||||
effectPacket.data().unknown_62 = 1;
|
effectPacket->data().unknown_62 = 1;
|
||||||
effectPacket.data().actionTextId = 7;
|
effectPacket->data().actionTextId = 7;
|
||||||
effectPacket.data().rotation = Math::Util::floatToUInt16Rot( getRot() );
|
effectPacket->data().rotation = Math::Util::floatToUInt16Rot( getRot() );
|
||||||
effectPacket.data().effectTarget = pTarget->getId();
|
effectPacket->data().effectTarget = pTarget->getId();
|
||||||
effectPacket.data().effects[0].value = damage;
|
effectPacket->data().effects[0].value = damage;
|
||||||
effectPacket.data().effects[0].effectType = Common::ActionEffectType::Damage;
|
effectPacket->data().effects[0].effectType = Common::ActionEffectType::Damage;
|
||||||
effectPacket.data().effects[0].hitSeverity = Common::ActionHitSeverityType::NormalDamage;
|
effectPacket->data().effects[0].hitSeverity = Common::ActionHitSeverityType::NormalDamage;
|
||||||
effectPacket.data().effects[0].unknown_3 = 71;
|
effectPacket->data().effects[0].unknown_3 = 71;
|
||||||
|
|
||||||
sendToInRangeSet(effectPacket, true);
|
sendToInRangeSet(effectPacket, true);
|
||||||
}
|
}
|
||||||
|
@ -1486,8 +1486,8 @@ uint16_t Core::Entity::Player::getItemLevel() const
|
||||||
void Core::Entity::Player::setEorzeaTimeOffset( uint64_t timestamp )
|
void Core::Entity::Player::setEorzeaTimeOffset( uint64_t timestamp )
|
||||||
{
|
{
|
||||||
// TODO: maybe change to persistent?
|
// TODO: maybe change to persistent?
|
||||||
ZoneChannelPacket< FFXIVIpcEorzeaTimeOffset > packet ( getId() );
|
auto packet = makeZonePacket< FFXIVIpcEorzeaTimeOffset >( getId() );
|
||||||
packet.data().timestamp = timestamp;
|
packet->data().timestamp = timestamp;
|
||||||
|
|
||||||
// Send to single player
|
// Send to single player
|
||||||
queuePacket( packet );
|
queuePacket( packet );
|
||||||
|
@ -1507,15 +1507,15 @@ void Core::Entity::Player::sendZonePackets()
|
||||||
{
|
{
|
||||||
getCurrentZone()->onBeforePlayerZoneIn( *this );
|
getCurrentZone()->onBeforePlayerZoneIn( *this );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcInit > initPacket( getId() );
|
auto initPacket = makeZonePacket< FFXIVIpcInit >( getId() );
|
||||||
initPacket.data().charId = getId();
|
initPacket->data().charId = getId();
|
||||||
queuePacket( initPacket );
|
queuePacket( initPacket );
|
||||||
|
|
||||||
sendInventory();
|
sendInventory();
|
||||||
|
|
||||||
if( isLogin() )
|
if( isLogin() )
|
||||||
{
|
{
|
||||||
queuePacket( ActorControlPacket143( getId(), SetCharaGearParamUI, m_equipDisplayFlags, 1 ) );
|
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), SetCharaGearParamUI, m_equipDisplayFlags, 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// set flags, will be reset automatically by zoning ( only on client side though )
|
// set flags, will be reset automatically by zoning ( only on client side though )
|
||||||
|
@ -1527,45 +1527,45 @@ void Core::Entity::Player::sendZonePackets()
|
||||||
// only initialize the UI if the player in fact just logged in.
|
// only initialize the UI if the player in fact just logged in.
|
||||||
if( isLogin() )
|
if( isLogin() )
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcCFAvailableContents > contentFinderList( getId() );
|
auto contentFinderList = makeZonePacket< FFXIVIpcCFAvailableContents >( getId() );
|
||||||
for( auto i = 0; i < sizeof( contentFinderList.data().contents ); i++ )
|
|
||||||
|
for( auto i = 0; i < sizeof( contentFinderList->data().contents ); i++ )
|
||||||
{
|
{
|
||||||
// unlock all contents for now
|
// unlock all contents for now
|
||||||
contentFinderList.data().contents[i] = 0xFF;
|
contentFinderList->data().contents[i] = 0xFF;
|
||||||
}
|
}
|
||||||
queuePacket( contentFinderList );
|
queuePacket( contentFinderList );
|
||||||
|
|
||||||
Server::InitUIPacket initUIPacket( *this );
|
queuePacket( boost::make_shared< InitUIPacket >( *this ) );
|
||||||
queuePacket( initUIPacket );
|
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcPlayerClassInfo > classInfoPacket( getId() );
|
auto classInfoPacket = makeZonePacket< FFXIVIpcPlayerClassInfo >( getId() );
|
||||||
classInfoPacket.data().classId = static_cast< uint8_t >( getClass() );
|
classInfoPacket->data().classId = static_cast< uint8_t >( getClass() );
|
||||||
classInfoPacket.data().unknown = 1;
|
classInfoPacket->data().unknown = 1;
|
||||||
classInfoPacket.data().level = getLevel();
|
classInfoPacket->data().level = getLevel();
|
||||||
classInfoPacket.data().level1 = getLevel();
|
classInfoPacket->data().level1 = getLevel();
|
||||||
queuePacket( classInfoPacket );
|
queuePacket( classInfoPacket );
|
||||||
|
|
||||||
m_itemLevel = getInventory()->calculateEquippedGearItemLevel();
|
m_itemLevel = getInventory()->calculateEquippedGearItemLevel();
|
||||||
sendItemLevel();
|
sendItemLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcInitZone > initZonePacket( getId() );
|
auto initZonePacket = makeZonePacket< FFXIVIpcInitZone >( getId() );
|
||||||
initZonePacket.data().zoneId = getCurrentZone()->getTerritoryId();
|
initZonePacket->data().zoneId = getCurrentZone()->getTerritoryId();
|
||||||
initZonePacket.data().weatherId = static_cast< uint8_t >( getCurrentZone()->getCurrentWeather() );
|
initZonePacket->data().weatherId = static_cast< uint8_t >( getCurrentZone()->getCurrentWeather() );
|
||||||
initZonePacket.data().bitmask = 0x1;
|
initZonePacket->data().bitmask = 0x1;
|
||||||
initZonePacket.data().unknown5 = 0x2A;
|
initZonePacket->data().unknown5 = 0x2A;
|
||||||
initZonePacket.data().festivalId = getCurrentZone()->getCurrentFestival();
|
initZonePacket->data().festivalId = getCurrentZone()->getCurrentFestival();
|
||||||
initZonePacket.data().pos.x = getPos().x;
|
initZonePacket->data().pos.x = getPos().x;
|
||||||
initZonePacket.data().pos.y = getPos().y;
|
initZonePacket->data().pos.y = getPos().y;
|
||||||
initZonePacket.data().pos.z = getPos().z;
|
initZonePacket->data().pos.z = getPos().z;
|
||||||
queuePacket( initZonePacket );
|
queuePacket( initZonePacket );
|
||||||
|
|
||||||
if( isLogin() )
|
if( isLogin() )
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVARR_IPC_UNK322 > unk322( getId() );
|
auto unk322 = makeZonePacket< FFXIVARR_IPC_UNK322 >( getId() );
|
||||||
queuePacket( unk322 );
|
queuePacket( unk322 );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVARR_IPC_UNK320 > unk320( getId() );
|
auto unk320 = makeZonePacket< FFXIVARR_IPC_UNK320 >( getId() );
|
||||||
queuePacket( unk320 );
|
queuePacket( unk320 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1589,16 +1589,16 @@ bool Core::Entity::Player::isDirectorInitialized() const
|
||||||
|
|
||||||
void Core::Entity::Player::sendTitleList()
|
void Core::Entity::Player::sendTitleList()
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcPlayerTitleList > titleListPacket( getId() );
|
auto titleListPacket = makeZonePacket< FFXIVIpcPlayerTitleList >( getId() );
|
||||||
memcpy( titleListPacket.data().titleList, getTitleList(), sizeof( titleListPacket.data().titleList ) );
|
memcpy( titleListPacket->data().titleList, getTitleList(), sizeof( titleListPacket->data().titleList ) );
|
||||||
|
|
||||||
queuePacket( titleListPacket );
|
queuePacket( titleListPacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::sendZoneInPackets( uint32_t param1, uint32_t param2 = 0, uint32_t param3 = 0, uint32_t param4 = 0, bool shouldSetStatus = false )
|
void Core::Entity::Player::sendZoneInPackets( uint32_t param1, uint32_t param2 = 0, uint32_t param3 = 0, uint32_t param4 = 0, bool shouldSetStatus = false )
|
||||||
{
|
{
|
||||||
auto zoneInPacket = ActorControlPacket143( getId(), ZoneIn, param1, param2, param3, param4 );
|
auto zoneInPacket = boost::make_shared< ActorControlPacket143 >( getId(), ZoneIn, param1, param2, param3, param4 );
|
||||||
auto SetStatusPacket = ActorControlPacket142( getId(), SetStatus, static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle ) );
|
auto SetStatusPacket = boost::make_shared< ActorControlPacket142 >( getId(), SetStatus, static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle ) );
|
||||||
|
|
||||||
if( !getGmInvis() )
|
if( !getGmInvis() )
|
||||||
sendToInRangeSet( zoneInPacket, true );
|
sendToInRangeSet( zoneInPacket, true );
|
||||||
|
@ -1647,7 +1647,7 @@ void Core::Entity::Player::finishZoning()
|
||||||
|
|
||||||
void Core::Entity::Player::emote( uint32_t emoteId, uint64_t targetId )
|
void Core::Entity::Player::emote( uint32_t emoteId, uint64_t targetId )
|
||||||
{
|
{
|
||||||
sendToInRangeSet( ActorControlPacket144( getId(), ActorControlType::Emote, emoteId, 0, 0, 0, targetId ) );
|
sendToInRangeSet( boost::make_shared< ActorControlPacket144 >( getId(), ActorControlType::Emote, emoteId, 0, 0, 0, targetId ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::teleportQuery( uint16_t aetheryteId )
|
void Core::Entity::Player::teleportQuery( uint16_t aetheryteId )
|
||||||
|
@ -1670,7 +1670,7 @@ void Core::Entity::Player::teleportQuery( uint16_t aetheryteId )
|
||||||
|
|
||||||
bool insufficientGil = getCurrency( Inventory::CurrencyType::Gil ) < cost;
|
bool insufficientGil = getCurrency( Inventory::CurrencyType::Gil ) < cost;
|
||||||
// TODO: figure out what param1 really does
|
// TODO: figure out what param1 really does
|
||||||
queuePacket( ActorControlPacket143( getId(), TeleportStart, insufficientGil ? 2 : 0, aetheryteId ) );
|
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), TeleportStart, insufficientGil ? 2 : 0, aetheryteId ) );
|
||||||
|
|
||||||
if( !insufficientGil )
|
if( !insufficientGil )
|
||||||
{
|
{
|
||||||
|
@ -1695,8 +1695,8 @@ void Core::Entity::Player::freeObjSpawnIndexForActorId( uint32_t actorId )
|
||||||
{
|
{
|
||||||
auto spawnId = m_objSpawnIndexAllocator.freeUsedSpawnIndex( actorId );
|
auto spawnId = m_objSpawnIndexAllocator.freeUsedSpawnIndex( actorId );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcObjectDespawn > freeObjectSpawnPacket( getId() );
|
auto freeObjectSpawnPacket = makeZonePacket< FFXIVIpcObjectDespawn >( getId() );
|
||||||
freeObjectSpawnPacket.data().spawnIndex = spawnId;
|
freeObjectSpawnPacket->data().spawnIndex = spawnId;
|
||||||
queuePacket( freeObjectSpawnPacket );
|
queuePacket( freeObjectSpawnPacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -495,9 +495,9 @@ public:
|
||||||
/*! send a quest specific message */
|
/*! send a quest specific message */
|
||||||
void sendQuestMessage( uint32_t questId, int8_t msgId, uint8_t type, uint32_t var1, uint32_t var2 );
|
void sendQuestMessage( uint32_t questId, int8_t msgId, uint8_t type, uint32_t var1, uint32_t var2 );
|
||||||
/*! queue a packet for the player */
|
/*! queue a packet for the player */
|
||||||
void queuePacket( Network::Packets::GamePacketPtr pPacket );
|
void queuePacket( Network::Packets::FFXIVPacketBasePtr pPacket );
|
||||||
/*! queue a char connection packet for the player */
|
/*! queue a char connection packet for the player */
|
||||||
void queueChatPacket( Network::Packets::GamePacketPtr pPacket );
|
void queueChatPacket( Network::Packets::FFXIVPacketBasePtr pPacket );
|
||||||
/*! returns true if loading is complete ( 0x69 has been received ) */
|
/*! returns true if loading is complete ( 0x69 has been received ) */
|
||||||
bool isLoadingComplete() const;
|
bool isLoadingComplete() const;
|
||||||
/*! set the loading complete bool */
|
/*! set the loading complete bool */
|
||||||
|
|
|
@ -85,8 +85,8 @@ void Core::Entity::Player::directorPlayScene( uint32_t eventId, uint32_t scene,
|
||||||
|
|
||||||
pEvent->setPlayedScene( true );
|
pEvent->setPlayedScene( true );
|
||||||
pEvent->setEventReturnCallback( nullptr );
|
pEvent->setEventReturnCallback( nullptr );
|
||||||
DirectorPlayScenePacket eventPlay( getId(), getId(), pEvent->getId(),
|
auto eventPlay = boost::make_shared< DirectorPlayScenePacket >( getId(), getId(), pEvent->getId(),
|
||||||
scene, flags, eventParam3, eventParam4, eventParam5 );
|
scene, flags, eventParam3, eventParam4, eventParam5 );
|
||||||
|
|
||||||
queuePacket( eventPlay );
|
queuePacket( eventPlay );
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,8 @@ void Core::Entity::Player::eventStart( uint64_t actorId, uint32_t eventId,
|
||||||
|
|
||||||
setStateFlag( PlayerStateFlag::InNpcEvent );
|
setStateFlag( PlayerStateFlag::InNpcEvent );
|
||||||
|
|
||||||
EventStartPacket eventStart( getId(), actorId, eventId, eventType, eventParam1, eventParam2 );
|
auto eventStart = boost::make_shared< EventStartPacket >( getId(), actorId, eventId,
|
||||||
|
eventType, eventParam1, eventParam2 );
|
||||||
|
|
||||||
queuePacket( eventStart );
|
queuePacket( eventStart );
|
||||||
|
|
||||||
|
@ -166,8 +167,8 @@ void Core::Entity::Player::playScene( uint32_t eventId, uint32_t scene,
|
||||||
pEvent->setPlayedScene( true );
|
pEvent->setPlayedScene( true );
|
||||||
pEvent->setEventReturnCallback( eventCallback );
|
pEvent->setEventReturnCallback( eventCallback );
|
||||||
pEvent->setSceneChainCallback( nullptr );
|
pEvent->setSceneChainCallback( nullptr );
|
||||||
EventPlayPacket eventPlay( getId(), pEvent->getActorId(), pEvent->getId(),
|
auto eventPlay = boost::make_shared< EventPlayPacket >( getId(), pEvent->getActorId(), pEvent->getId(),
|
||||||
scene, flags, eventParam2, eventParam3, eventParam4 );
|
scene, flags, eventParam2, eventParam3, eventParam4 );
|
||||||
|
|
||||||
queuePacket( eventPlay );
|
queuePacket( eventPlay );
|
||||||
}
|
}
|
||||||
|
@ -183,8 +184,8 @@ void Core::Entity::Player::playSceneChain( uint32_t eventId, uint32_t scene, uin
|
||||||
pEvent->setPlayedScene( true );
|
pEvent->setPlayedScene( true );
|
||||||
pEvent->setSceneChainCallback( sceneChainCallback );
|
pEvent->setSceneChainCallback( sceneChainCallback );
|
||||||
pEvent->setEventReturnCallback( nullptr );
|
pEvent->setEventReturnCallback( nullptr );
|
||||||
EventPlayPacket eventPlay( getId(), pEvent->getActorId(), pEvent->getId(),
|
auto eventPlay = boost::make_shared< EventPlayPacket >( getId(), pEvent->getActorId(), pEvent->getId(),
|
||||||
scene, flags, eventParam2, eventParam3, eventParam4 );
|
scene, flags, eventParam2, eventParam3, eventParam4 );
|
||||||
|
|
||||||
queuePacket( eventPlay );
|
queuePacket( eventPlay );
|
||||||
}
|
}
|
||||||
|
@ -223,7 +224,8 @@ void Core::Entity::Player::eventFinish( uint32_t eventId, uint32_t freePlayer )
|
||||||
{
|
{
|
||||||
case Event::EventHandler::Nest:
|
case Event::EventHandler::Nest:
|
||||||
{
|
{
|
||||||
queuePacket( EventFinishPacket( getId(), pEvent->getId(), pEvent->getEventType(), pEvent->getEventParam() ) );
|
queuePacket( boost::make_shared< EventFinishPacket >( getId(), pEvent->getId(),
|
||||||
|
pEvent->getEventType(), pEvent->getEventParam() ) );
|
||||||
removeEvent( pEvent->getId() );
|
removeEvent( pEvent->getId() );
|
||||||
|
|
||||||
auto events = eventList();
|
auto events = eventList();
|
||||||
|
@ -234,8 +236,8 @@ void Core::Entity::Player::eventFinish( uint32_t eventId, uint32_t freePlayer )
|
||||||
if( it.second->hasPlayedScene() == false )
|
if( it.second->hasPlayedScene() == false )
|
||||||
{
|
{
|
||||||
// TODO: not happy with this, this is also prone to break wit more than one remaining event in there
|
// TODO: not happy with this, this is also prone to break wit more than one remaining event in there
|
||||||
queuePacket( EventFinishPacket( getId(), it.second->getId(), it.second->getEventType(),
|
queuePacket( boost::make_shared< EventFinishPacket >( getId(), it.second->getId(),
|
||||||
it.second->getEventParam() ) );
|
it.second->getEventType(), it.second->getEventParam() ) );
|
||||||
removeEvent( it.second->getId() );
|
removeEvent( it.second->getId() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,7 +246,8 @@ void Core::Entity::Player::eventFinish( uint32_t eventId, uint32_t freePlayer )
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
queuePacket( EventFinishPacket( getId(), pEvent->getId(), pEvent->getEventType(), pEvent->getEventParam() ) );
|
queuePacket( boost::make_shared< EventFinishPacket >( getId(), pEvent->getId(),
|
||||||
|
pEvent->getEventType(), pEvent->getEventParam() ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ Core::InventoryPtr Core::Entity::Player::getInventory() const
|
||||||
|
|
||||||
void Core::Entity::Player::sendItemLevel()
|
void Core::Entity::Player::sendItemLevel()
|
||||||
{
|
{
|
||||||
queuePacket( ActorControlPacket142( getId(), SetItemLevel, getItemLevel(), 0 ) );
|
queuePacket( boost::make_shared< ActorControlPacket142 >( getId(), SetItemLevel, getItemLevel(), 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This has to be redone and simplified
|
// TODO: This has to be redone and simplified
|
||||||
|
@ -145,11 +145,11 @@ void Core::Entity::Player::addCurrency( uint8_t type, uint32_t amount )
|
||||||
if( !m_pInventory->addCurrency( static_cast< Inventory::CurrencyType >( type ), amount ) )
|
if( !m_pInventory->addCurrency( static_cast< Inventory::CurrencyType >( type ), amount ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcUpdateInventorySlot > invUpPacket( getId() );
|
auto invUpPacket = makeZonePacket< FFXIVIpcUpdateInventorySlot >( getId() );
|
||||||
invUpPacket.data().containerId = Inventory::InventoryType::Currency;
|
invUpPacket->data().containerId = Inventory::InventoryType::Currency;
|
||||||
invUpPacket.data().catalogId = 1;
|
invUpPacket->data().catalogId = 1;
|
||||||
invUpPacket.data().quantity = m_pInventory->getCurrency( static_cast< Inventory::CurrencyType >( type ) );
|
invUpPacket->data().quantity = m_pInventory->getCurrency( static_cast< Inventory::CurrencyType >( type ) );
|
||||||
invUpPacket.data().slot = static_cast< uint8_t >( type ) - 1;
|
invUpPacket->data().slot = static_cast< uint8_t >( type ) - 1;
|
||||||
|
|
||||||
queuePacket( invUpPacket );
|
queuePacket( invUpPacket );
|
||||||
}
|
}
|
||||||
|
@ -159,11 +159,11 @@ void Core::Entity::Player::removeCurrency( uint8_t type, uint32_t amount )
|
||||||
if( !m_pInventory->removeCurrency( static_cast< Inventory::CurrencyType >( type ), amount ) )
|
if( !m_pInventory->removeCurrency( static_cast< Inventory::CurrencyType >( type ), amount ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcUpdateInventorySlot > invUpPacket( getId() );
|
auto invUpPacket = makeZonePacket< FFXIVIpcUpdateInventorySlot >( getId() );
|
||||||
invUpPacket.data().containerId = Inventory::InventoryType::Currency;
|
invUpPacket->data().containerId = Inventory::InventoryType::Currency;
|
||||||
invUpPacket.data().catalogId = 1;
|
invUpPacket->data().catalogId = 1;
|
||||||
invUpPacket.data().quantity = m_pInventory->getCurrency( static_cast< Inventory::CurrencyType >( type ) );
|
invUpPacket->data().quantity = m_pInventory->getCurrency( static_cast< Inventory::CurrencyType >( type ) );
|
||||||
invUpPacket.data().slot = static_cast< uint8_t >( type ) - 1;
|
invUpPacket->data().slot = static_cast< uint8_t >( type ) - 1;
|
||||||
|
|
||||||
queuePacket( invUpPacket );
|
queuePacket( invUpPacket );
|
||||||
}
|
}
|
||||||
|
@ -179,15 +179,16 @@ void Core::Entity::Player::addCrystal( uint8_t type, uint32_t amount )
|
||||||
if( !m_pInventory->addCrystal( static_cast< Inventory::CrystalType >( type ), amount ) )
|
if( !m_pInventory->addCrystal( static_cast< Inventory::CrystalType >( type ), amount ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcUpdateInventorySlot > invUpPacket( getId() );
|
auto invUpPacket = makeZonePacket< FFXIVIpcUpdateInventorySlot >( getId() );
|
||||||
invUpPacket.data().containerId = Inventory::InventoryType::Crystal;
|
invUpPacket->data().containerId = Inventory::InventoryType::Crystal;
|
||||||
invUpPacket.data().catalogId = static_cast< uint8_t >( type ) + 1;
|
invUpPacket->data().catalogId = static_cast< uint8_t >( type ) + 1;
|
||||||
invUpPacket.data().quantity = m_pInventory->getCrystal( static_cast< Inventory::CrystalType >( type ) );
|
invUpPacket->data().quantity = m_pInventory->getCrystal( static_cast< Inventory::CrystalType >( type ) );
|
||||||
invUpPacket.data().slot = static_cast< uint8_t >( type ) - 1;
|
invUpPacket->data().slot = static_cast< uint8_t >( type ) - 1;
|
||||||
|
|
||||||
queuePacket( invUpPacket );
|
queuePacket( invUpPacket );
|
||||||
|
|
||||||
queuePacket( ActorControlPacket143( getId(), ItemObtainIcon, static_cast< uint8_t >( type ) + 1, amount ) );
|
queuePacket( boost::make_shared< ActorControlPacket143 >( getId(), ItemObtainIcon,
|
||||||
|
static_cast< uint8_t >( type ) + 1, amount ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::removeCrystal( uint8_t type, uint32_t amount )
|
void Core::Entity::Player::removeCrystal( uint8_t type, uint32_t amount )
|
||||||
|
@ -195,11 +196,11 @@ void Core::Entity::Player::removeCrystal( uint8_t type, uint32_t amount )
|
||||||
if( !m_pInventory->removeCrystal( static_cast< Inventory::CrystalType >( type ), amount ) )
|
if( !m_pInventory->removeCrystal( static_cast< Inventory::CrystalType >( type ), amount ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcUpdateInventorySlot > invUpPacket( getId() );
|
auto invUpPacket = makeZonePacket< FFXIVIpcUpdateInventorySlot >( getId() );
|
||||||
invUpPacket.data().containerId = Inventory::InventoryType::Crystal;
|
invUpPacket->data().containerId = Inventory::InventoryType::Crystal;
|
||||||
invUpPacket.data().catalogId = static_cast< uint8_t >( type ) + 1;
|
invUpPacket->data().catalogId = static_cast< uint8_t >( type ) + 1;
|
||||||
invUpPacket.data().quantity = m_pInventory->getCrystal( static_cast< Inventory::CrystalType >( type ) );
|
invUpPacket->data().quantity = m_pInventory->getCrystal( static_cast< Inventory::CrystalType >( type ) );
|
||||||
invUpPacket.data().slot = static_cast< uint8_t >( type ) - 1;
|
invUpPacket->data().slot = static_cast< uint8_t >( type ) - 1;
|
||||||
|
|
||||||
queuePacket( invUpPacket );
|
queuePacket( invUpPacket );
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,16 +42,16 @@ void Core::Entity::Player::removeQuest( uint16_t questId )
|
||||||
if( ( idx != -1 ) && ( m_activeQuests[idx] != nullptr ) )
|
if( ( idx != -1 ) && ( m_activeQuests[idx] != nullptr ) )
|
||||||
{
|
{
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcQuestUpdate > questUpdatePacket( getId() );
|
auto questUpdatePacket = makeZonePacket< FFXIVIpcQuestUpdate >( getId() );
|
||||||
questUpdatePacket.data().slot = static_cast< uint8_t >( idx );
|
questUpdatePacket->data().slot = static_cast< uint8_t >( idx );
|
||||||
questUpdatePacket.data().questInfo.c.questId = 0;
|
questUpdatePacket->data().questInfo.c.questId = 0;
|
||||||
questUpdatePacket.data().questInfo.c.sequence = 0xFF;
|
questUpdatePacket->data().questInfo.c.sequence = 0xFF;
|
||||||
queuePacket( questUpdatePacket );
|
queuePacket( questUpdatePacket );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcQuestFinish > questFinishPacket( getId() );
|
auto questFinishPacket = makeZonePacket< FFXIVIpcQuestFinish >( getId() );
|
||||||
questFinishPacket.data().questId = questId;
|
questFinishPacket->data().questId = questId;
|
||||||
questFinishPacket.data().flag1 = 1;
|
questFinishPacket->data().flag1 = 1;
|
||||||
questFinishPacket.data().flag2 = 1;
|
questFinishPacket->data().flag2 = 1;
|
||||||
queuePacket( questFinishPacket );
|
queuePacket( questFinishPacket );
|
||||||
|
|
||||||
for( int32_t ii = 0; ii < 5; ii++ )
|
for( int32_t ii = 0; ii < 5; ii++ )
|
||||||
|
@ -875,11 +875,12 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint8_t sequence )
|
||||||
{
|
{
|
||||||
uint8_t index = getQuestIndex( questId );
|
uint8_t index = getQuestIndex( questId );
|
||||||
auto pNewQuest = m_activeQuests[index];
|
auto pNewQuest = m_activeQuests[index];
|
||||||
ZoneChannelPacket< FFXIVIpcQuestUpdate > pe_qa( getId() );
|
|
||||||
|
auto questUpdatePacket = makeZonePacket< FFXIVIpcQuestUpdate >( getId() );
|
||||||
pNewQuest->c.sequence = sequence;
|
pNewQuest->c.sequence = sequence;
|
||||||
pe_qa.data().slot = index;
|
questUpdatePacket->data().slot = index;
|
||||||
pe_qa.data().questInfo = *pNewQuest;
|
questUpdatePacket->data().questInfo = *pNewQuest;
|
||||||
queuePacket( pe_qa );
|
queuePacket( questUpdatePacket );
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -905,10 +906,10 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint8_t sequence )
|
||||||
m_questIdToQuestIdx[questId] = idx;
|
m_questIdToQuestIdx[questId] = idx;
|
||||||
m_questIdxToQuestId[idx] = questId;
|
m_questIdxToQuestId[idx] = questId;
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcQuestUpdate > pe_qa( getId() );
|
auto questUpdatePacket = makeZonePacket< FFXIVIpcQuestUpdate >( getId() );
|
||||||
pe_qa.data().slot = idx;
|
questUpdatePacket->data().slot = idx;
|
||||||
pe_qa.data().questInfo = *pNewQuest;
|
questUpdatePacket->data().questInfo = *pNewQuest;
|
||||||
queuePacket( pe_qa );
|
queuePacket( questUpdatePacket );
|
||||||
|
|
||||||
for( int32_t ii = 0; ii < 5; ii++ )
|
for( int32_t ii = 0; ii < 5; ii++ )
|
||||||
{
|
{
|
||||||
|
@ -927,14 +928,14 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint8_t sequence )
|
||||||
|
|
||||||
void Core::Entity::Player::sendQuestTracker()
|
void Core::Entity::Player::sendQuestTracker()
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcQuestTracker > trackerPacket( getId() );
|
auto trackerPacket = makeZonePacket< FFXIVIpcQuestTracker >( getId() );
|
||||||
|
|
||||||
for( int32_t ii = 0; ii < 5; ii++ )
|
for( int32_t ii = 0; ii < 5; ii++ )
|
||||||
{
|
{
|
||||||
if( m_questTracking[ii] >= 0 )
|
if( m_questTracking[ii] >= 0 )
|
||||||
{
|
{
|
||||||
trackerPacket.data().entry[ii].active = 1;
|
trackerPacket->data().entry[ii].active = 1;
|
||||||
trackerPacket.data().entry[ii].questIndex = static_cast< uint8_t >( m_questTracking[ii] );
|
trackerPacket->data().entry[ii].questIndex = static_cast< uint8_t >( m_questTracking[ii] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
queuePacket( trackerPacket );
|
queuePacket( trackerPacket );
|
||||||
|
@ -972,7 +973,7 @@ void Core::Entity::Player::setQuestTracker( uint16_t index, int16_t flag )
|
||||||
|
|
||||||
void Core::Entity::Player::sendQuestInfo()
|
void Core::Entity::Player::sendQuestInfo()
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcQuestActiveList > pe_qa( getId() );
|
auto activeQuestListPacket = makeZonePacket< FFXIVIpcQuestActiveList >( getId() );
|
||||||
|
|
||||||
for( int32_t i = 0; i < 30; i++ )
|
for( int32_t i = 0; i < 30; i++ )
|
||||||
{
|
{
|
||||||
|
@ -980,24 +981,24 @@ void Core::Entity::Player::sendQuestInfo()
|
||||||
if( m_activeQuests[i] != nullptr )
|
if( m_activeQuests[i] != nullptr )
|
||||||
{
|
{
|
||||||
|
|
||||||
auto& quest = pe_qa.data().activeQuests[i];
|
auto& quest = activeQuestListPacket->data().activeQuests[i];
|
||||||
quest = *m_activeQuests[i];
|
quest = *m_activeQuests[i];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
queuePacket( pe_qa );
|
queuePacket( activeQuestListPacket );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcQuestCompleteList > pe_qc( getId() );
|
auto completeQuestListPacket = makeZonePacket< FFXIVIpcQuestCompleteList >( getId() );
|
||||||
memcpy( pe_qc.data().questCompleteMask, m_questCompleteFlags, sizeof( m_questCompleteFlags ) );
|
memcpy( completeQuestListPacket->data().questCompleteMask, m_questCompleteFlags, sizeof( m_questCompleteFlags ) );
|
||||||
queuePacket( pe_qc );
|
queuePacket( completeQuestListPacket );
|
||||||
|
|
||||||
sendQuestTracker();
|
sendQuestTracker();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Entity::Player::sendQuestMessage( uint32_t questId, int8_t msgId, uint8_t type, uint32_t var1, uint32_t var2 )
|
void Core::Entity::Player::sendQuestMessage( uint32_t questId, int8_t msgId, uint8_t type, uint32_t var1, uint32_t var2 )
|
||||||
{
|
{
|
||||||
queuePacket( QuestMessagePacket( getAsPlayer(), questId, msgId, type, var1, var2 ) );
|
queuePacket( boost::make_shared< QuestMessagePacket >( getAsPlayer(), questId, msgId, type, var1, var2 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1069,7 +1070,7 @@ bool Core::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t optional
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<QuestActive> Core::Entity::Player::getQuestActive( uint16_t index )
|
boost::shared_ptr< QuestActive > Core::Entity::Player::getQuestActive( uint16_t index )
|
||||||
{
|
{
|
||||||
return m_activeQuests[index];
|
return m_activeQuests[index];
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,10 @@
|
||||||
|
|
||||||
extern Core::Framework g_fw;
|
extern Core::Framework g_fw;
|
||||||
|
|
||||||
|
using namespace Network;
|
||||||
|
using namespace Network::Packets;
|
||||||
|
using namespace Network::Packets::Server;
|
||||||
|
|
||||||
// instanciate and initialize commands
|
// instanciate and initialize commands
|
||||||
Core::DebugCommandHandler::DebugCommandHandler()
|
Core::DebugCommandHandler::DebugCommandHandler()
|
||||||
{
|
{
|
||||||
|
@ -179,11 +183,10 @@ void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost:
|
||||||
player.getPos().y + static_cast< float >( posY ),
|
player.getPos().y + static_cast< float >( posY ),
|
||||||
player.getPos().z + static_cast< float >( posZ ) );
|
player.getPos().z + static_cast< float >( posZ ) );
|
||||||
|
|
||||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorSetPos >
|
auto setActorPosPacket = makeZonePacket< FFXIVIpcActorSetPos >( player.getId() );
|
||||||
setActorPosPacket( player.getId() );
|
setActorPosPacket->data().x = player.getPos().x;
|
||||||
setActorPosPacket.data().x = player.getPos().x;
|
setActorPosPacket->data().y = player.getPos().y;
|
||||||
setActorPosPacket.data().y = player.getPos().y;
|
setActorPosPacket->data().z = player.getPos().z;
|
||||||
setActorPosPacket.data().z = player.getPos().z;
|
|
||||||
player.queuePacket( setActorPosPacket );
|
player.queuePacket( setActorPosPacket );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -200,9 +203,9 @@ void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost:
|
||||||
int32_t discover_id;
|
int32_t discover_id;
|
||||||
sscanf( params.c_str(), "%i %i", &map_id, &discover_id );
|
sscanf( params.c_str(), "%i %i", &map_id, &discover_id );
|
||||||
|
|
||||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcDiscovery > discoveryPacket( player.getId() );
|
auto discoveryPacket = makeZonePacket< FFXIVIpcDiscovery >( player.getId() );
|
||||||
discoveryPacket.data().map_id = map_id;
|
discoveryPacket->data().map_id = map_id;
|
||||||
discoveryPacket.data().map_part_id = discover_id;
|
discoveryPacket->data().map_part_id = discover_id;
|
||||||
player.queuePacket( discoveryPacket );
|
player.queuePacket( discoveryPacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +231,7 @@ void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost:
|
||||||
else if( subCommand == "discovery_reset" )
|
else if( subCommand == "discovery_reset" )
|
||||||
{
|
{
|
||||||
player.resetDiscovery();
|
player.resetDiscovery();
|
||||||
player.queuePacket( Network::Packets::Server::InitUIPacket( player ) );
|
player.queuePacket( boost::make_shared< InitUIPacket >( player ) );
|
||||||
}
|
}
|
||||||
else if( subCommand == "classjob" )
|
else if( subCommand == "classjob" )
|
||||||
{
|
{
|
||||||
|
@ -282,9 +285,8 @@ void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost:
|
||||||
int32_t id;
|
int32_t id;
|
||||||
sscanf( params.c_str(), "%d", &id );
|
sscanf( params.c_str(), "%d", &id );
|
||||||
|
|
||||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcMSQTrackerProgress > msqPacket(
|
auto msqPacket = makeZonePacket< FFXIVIpcMSQTrackerProgress >( player.getId() );
|
||||||
player.getId());
|
msqPacket->data().id = id;
|
||||||
msqPacket.data().id = id;
|
|
||||||
player.queuePacket( msqPacket );
|
player.queuePacket( msqPacket );
|
||||||
|
|
||||||
player.sendDebug( "MSQ Guide updated " );
|
player.sendDebug( "MSQ Guide updated " );
|
||||||
|
@ -294,8 +296,8 @@ void Core::DebugCommandHandler::set( char * data, Entity::Player& player, boost:
|
||||||
int32_t id;
|
int32_t id;
|
||||||
sscanf( params.c_str(), "%d", &id );
|
sscanf( params.c_str(), "%d", &id );
|
||||||
|
|
||||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcMSQTrackerComplete > msqPacket ( player.getId() );
|
auto msqPacket = makeZonePacket< FFXIVIpcMSQTrackerComplete >( player.getId() );
|
||||||
msqPacket.data().id = id;
|
msqPacket->data().id = id;
|
||||||
player.queuePacket( msqPacket );
|
player.queuePacket( msqPacket );
|
||||||
|
|
||||||
player.sendDebug( "MSQ Guide updated " );
|
player.sendDebug( "MSQ Guide updated " );
|
||||||
|
@ -377,8 +379,9 @@ void Core::DebugCommandHandler::add( char * data, Entity::Player& player, boost:
|
||||||
// temporary research packet
|
// temporary research packet
|
||||||
int32_t opcode;
|
int32_t opcode;
|
||||||
sscanf( params.c_str(), "%x", &opcode );
|
sscanf( params.c_str(), "%x", &opcode );
|
||||||
auto pPe = Network::Packets::make_GamePacket( opcode, 0x30, player.getId(), player.getId() );
|
// TODO: fix for new setup
|
||||||
player.queuePacket( pPe );
|
//auto pPe = Network::Packets::make_GamePacket( opcode, 0x30, player.getId(), player.getId() );
|
||||||
|
//player.queuePacket( pPe );
|
||||||
}
|
}
|
||||||
else if( subCommand == "actrl" )
|
else if( subCommand == "actrl" )
|
||||||
{
|
{
|
||||||
|
@ -398,14 +401,14 @@ void Core::DebugCommandHandler::add( char * data, Entity::Player& player, boost:
|
||||||
|
|
||||||
player.sendNotice( "Injecting ACTOR_CONTROL " + std::to_string( opcode ) );
|
player.sendNotice( "Injecting ACTOR_CONTROL " + std::to_string( opcode ) );
|
||||||
|
|
||||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorControl143 > actorControl( playerId, player.getId() );
|
auto actorControl = makeZonePacket< FFXIVIpcActorControl143 >( playerId, player.getId() );
|
||||||
actorControl.data().category = opcode;
|
actorControl->data().category = opcode;
|
||||||
actorControl.data().param1 = param1;
|
actorControl->data().param1 = param1;
|
||||||
actorControl.data().param2 = param2;
|
actorControl->data().param2 = param2;
|
||||||
actorControl.data().param3 = param3;
|
actorControl->data().param3 = param3;
|
||||||
actorControl.data().param4 = param4;
|
actorControl->data().param4 = param4;
|
||||||
actorControl.data().param5 = param5;
|
actorControl->data().param5 = param5;
|
||||||
actorControl.data().param6 = param6;
|
actorControl->data().param6 = param6;
|
||||||
player.queuePacket( actorControl );
|
player.queuePacket( actorControl );
|
||||||
|
|
||||||
|
|
||||||
|
@ -579,12 +582,11 @@ void Core::DebugCommandHandler::nudge( char * data, Entity::Player& player, boos
|
||||||
}
|
}
|
||||||
if( offset != 0 )
|
if( offset != 0 )
|
||||||
{
|
{
|
||||||
Network::Packets::ZoneChannelPacket< Network::Packets::Server::FFXIVIpcActorSetPos >
|
auto setActorPosPacket = makeZonePacket< FFXIVIpcActorSetPos >( player.getId() );
|
||||||
setActorPosPacket( player.getId() );
|
setActorPosPacket->data().x = player.getPos().x;
|
||||||
setActorPosPacket.data().x = player.getPos().x;
|
setActorPosPacket->data().y = player.getPos().y;
|
||||||
setActorPosPacket.data().y = player.getPos().y;
|
setActorPosPacket->data().z = player.getPos().z;
|
||||||
setActorPosPacket.data().z = player.getPos().z;
|
setActorPosPacket->data().r16 = Math::Util::floatToUInt16Rot( player.getRot() );
|
||||||
setActorPosPacket.data().r16 = Math::Util::floatToUInt16Rot( player.getRot() );
|
|
||||||
player.queuePacket( setActorPosPacket );
|
player.queuePacket( setActorPosPacket );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,22 +41,23 @@ uint8_t Core::Event::Director::getSequence() const
|
||||||
|
|
||||||
void Core::Event::Director::sendDirectorClear( Core::Entity::Player& player ) const
|
void Core::Event::Director::sendDirectorClear( Core::Entity::Player& player ) const
|
||||||
{
|
{
|
||||||
player.queuePacket( ActorControlPacket143( player.getId(), DirectorClear, m_directorId ) );
|
player.queuePacket( boost::make_shared< ActorControlPacket143 >( player.getId(), DirectorClear, m_directorId ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Event::Director::sendDirectorVars( Core::Entity::Player& player ) const
|
void Core::Event::Director::sendDirectorVars( Core::Entity::Player& player ) const
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcDirectorVars > varPacket( player.getId() );
|
auto varPacket = makeZonePacket< FFXIVIpcDirectorVars >( player.getId() );
|
||||||
varPacket.data().m_directorId = getDirectorId();
|
varPacket->data().m_directorId = getDirectorId();
|
||||||
varPacket.data().m_sequence = getSequence();
|
varPacket->data().m_sequence = getSequence();
|
||||||
varPacket.data().m_branch = 0;
|
varPacket->data().m_branch = 0;
|
||||||
memcpy( varPacket.data().m_unionData, m_unionData.arrData, sizeof( varPacket.data().m_unionData ) );
|
memcpy( varPacket->data().m_unionData, m_unionData.arrData, sizeof( varPacket->data().m_unionData ) );
|
||||||
player.queuePacket( varPacket );
|
player.queuePacket( varPacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Event::Director::sendDirectorInit( Core::Entity::Player& player ) const
|
void Core::Event::Director::sendDirectorInit( Core::Entity::Player& player ) const
|
||||||
{
|
{
|
||||||
player.queuePacket( ActorControlPacket143( player.getId(), DirectorInit, m_directorId, m_contentId ) );
|
player.queuePacket( boost::make_shared< ActorControlPacket143 >( player.getId(), DirectorInit,
|
||||||
|
m_directorId, m_contentId ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Event::Director::DirectorType Core::Event::Director::getType() const
|
Core::Event::Director::DirectorType Core::Event::Director::getType() const
|
||||||
|
|
|
@ -3,12 +3,14 @@
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <memory>
|
||||||
#include <boost/make_shared.hpp>
|
#include <boost/make_shared.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#define TYPE_FORWARD( x ) \
|
#define TYPE_FORWARD( x ) \
|
||||||
class x; \
|
class x; \
|
||||||
typedef boost::shared_ptr< x > x ## Ptr; \
|
typedef boost::shared_ptr< x > x ## Ptr; \
|
||||||
|
typedef std::unique_ptr< x > x ## UPtr; \
|
||||||
template< typename...Args > \
|
template< typename...Args > \
|
||||||
x ## Ptr make_ ## x( Args &&...args ) { \
|
x ## Ptr make_ ## x( Args &&...args ) { \
|
||||||
return boost::make_shared< x >( std::forward< Args >( args ) ... ); }\
|
return boost::make_shared< x >( std::forward< Args >( args ) ... ); }\
|
||||||
|
@ -68,6 +70,7 @@ namespace Core
|
||||||
namespace Packets
|
namespace Packets
|
||||||
{
|
{
|
||||||
TYPE_FORWARD( GamePacket );
|
TYPE_FORWARD( GamePacket );
|
||||||
|
TYPE_FORWARD( FFXIVPacketBase );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -522,17 +522,19 @@ int16_t Core::Inventory::addItem( uint16_t inventoryId, int8_t slotId, uint32_t
|
||||||
" WHERE storageId = " + std::to_string( inventoryId ) +
|
" WHERE storageId = " + std::to_string( inventoryId ) +
|
||||||
" AND CharacterId = " + std::to_string( m_pOwner->getId() ) );
|
" AND CharacterId = " + std::to_string( m_pOwner->getId() ) );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcUpdateInventorySlot > invUpPacket( m_pOwner->getId() );
|
|
||||||
invUpPacket.data().containerId = inventoryId;
|
auto invUpPacket = makeZonePacket< FFXIVIpcUpdateInventorySlot >( m_pOwner->getId() );
|
||||||
invUpPacket.data().catalogId = catalogId;
|
invUpPacket->data().containerId = inventoryId;
|
||||||
invUpPacket.data().quantity = item->getStackSize();
|
invUpPacket->data().catalogId = catalogId;
|
||||||
invUpPacket.data().hqFlag = item->isHq() ? 1 : 0;
|
invUpPacket->data().quantity = item->getStackSize();
|
||||||
invUpPacket.data().slot = rSlotId;
|
invUpPacket->data().hqFlag = item->isHq() ? 1 : 0;
|
||||||
invUpPacket.data().condition = 30000;
|
invUpPacket->data().slot = rSlotId;
|
||||||
|
invUpPacket->data().condition = 30000;
|
||||||
m_pOwner->queuePacket( invUpPacket );
|
m_pOwner->queuePacket( invUpPacket );
|
||||||
|
|
||||||
if( !silent )
|
if( !silent )
|
||||||
m_pOwner->queuePacket( ActorControlPacket143( m_pOwner->getId(), ItemObtainIcon, catalogId, item->getStackSize() ) );
|
m_pOwner->queuePacket( boost::make_shared< ActorControlPacket143 >( m_pOwner->getId(), ItemObtainIcon,
|
||||||
|
catalogId, item->getStackSize() ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -711,19 +713,19 @@ void Core::Inventory::discardItem( uint16_t fromInventoryId, uint8_t fromSlotId
|
||||||
m_inventoryMap[fromInventoryId]->removeItem( fromSlotId );
|
m_inventoryMap[fromInventoryId]->removeItem( fromSlotId );
|
||||||
updateContainer( fromInventoryId, fromSlotId, nullptr );
|
updateContainer( fromInventoryId, fromSlotId, nullptr );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcInventoryTransaction > invTransPacket( m_pOwner->getId() );
|
auto invTransPacket = makeZonePacket< FFXIVIpcInventoryTransaction >( m_pOwner->getId() );
|
||||||
invTransPacket.data().transactionId = transactionId;
|
invTransPacket->data().transactionId = transactionId;
|
||||||
invTransPacket.data().ownerId = m_pOwner->getId();
|
invTransPacket->data().ownerId = m_pOwner->getId();
|
||||||
invTransPacket.data().storageId = fromInventoryId;
|
invTransPacket->data().storageId = fromInventoryId;
|
||||||
invTransPacket.data().catalogId = fromItem->getId();
|
invTransPacket->data().catalogId = fromItem->getId();
|
||||||
invTransPacket.data().stackSize = fromItem->getStackSize();
|
invTransPacket->data().stackSize = fromItem->getStackSize();
|
||||||
invTransPacket.data().slotId = fromSlotId;
|
invTransPacket->data().slotId = fromSlotId;
|
||||||
invTransPacket.data().type = 7;
|
invTransPacket->data().type = 7;
|
||||||
m_pOwner->queuePacket( invTransPacket );
|
m_pOwner->queuePacket( invTransPacket );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcInventoryTransactionFinish > invTransFinPacket( m_pOwner->getId() );
|
auto invTransFinPacket = makeZonePacket< FFXIVIpcInventoryTransactionFinish >( m_pOwner->getId() );
|
||||||
invTransFinPacket.data().transactionId = transactionId;
|
invTransFinPacket->data().transactionId = transactionId;
|
||||||
invTransFinPacket.data().transactionId1 = transactionId;
|
invTransFinPacket->data().transactionId1 = transactionId;
|
||||||
m_pOwner->queuePacket( invTransFinPacket );
|
m_pOwner->queuePacket( invTransFinPacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -902,34 +904,34 @@ void Core::Inventory::send()
|
||||||
|
|
||||||
if( it->second->getId() == InventoryType::Currency || it->second->getId() == InventoryType::Crystal )
|
if( it->second->getId() == InventoryType::Currency || it->second->getId() == InventoryType::Crystal )
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcCurrencyCrystalInfo > currencyInfoPacket( m_pOwner->getId() );
|
auto currencyInfoPacket = makeZonePacket< FFXIVIpcCurrencyCrystalInfo >( m_pOwner->getId() );
|
||||||
currencyInfoPacket.data().sequence = count;
|
currencyInfoPacket->data().sequence = count;
|
||||||
currencyInfoPacket.data().catalogId = itM->second->getId();
|
currencyInfoPacket->data().catalogId = itM->second->getId();
|
||||||
currencyInfoPacket.data().unknown = 1;
|
currencyInfoPacket->data().unknown = 1;
|
||||||
currencyInfoPacket.data().quantity = itM->second->getStackSize();
|
currencyInfoPacket->data().quantity = itM->second->getStackSize();
|
||||||
currencyInfoPacket.data().containerId = it->second->getId();
|
currencyInfoPacket->data().containerId = it->second->getId();
|
||||||
currencyInfoPacket.data().slot = 0;
|
currencyInfoPacket->data().slot = 0;
|
||||||
m_pOwner->queuePacket( currencyInfoPacket );
|
m_pOwner->queuePacket( currencyInfoPacket );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcItemInfo > itemInfoPacket( m_pOwner->getId() );
|
auto itemInfoPacket = makeZonePacket< FFXIVIpcItemInfo >( m_pOwner->getId() );
|
||||||
itemInfoPacket.data().sequence = count;
|
itemInfoPacket->data().sequence = count;
|
||||||
itemInfoPacket.data().containerId = it->second->getId();
|
itemInfoPacket->data().containerId = it->second->getId();
|
||||||
itemInfoPacket.data().slot = itM->first;
|
itemInfoPacket->data().slot = itM->first;
|
||||||
itemInfoPacket.data().quantity = itM->second->getStackSize();
|
itemInfoPacket->data().quantity = itM->second->getStackSize();
|
||||||
itemInfoPacket.data().catalogId = itM->second->getId();
|
itemInfoPacket->data().catalogId = itM->second->getId();
|
||||||
itemInfoPacket.data().condition = 30000;
|
itemInfoPacket->data().condition = 30000;
|
||||||
itemInfoPacket.data().spiritBond = 0;
|
itemInfoPacket->data().spiritBond = 0;
|
||||||
itemInfoPacket.data().hqFlag = itM->second->isHq() ? 1 : 0;
|
itemInfoPacket->data().hqFlag = itM->second->isHq() ? 1 : 0;
|
||||||
m_pOwner->queuePacket( itemInfoPacket );
|
m_pOwner->queuePacket( itemInfoPacket );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcContainerInfo > containerInfoPacket( m_pOwner->getId() );
|
auto containerInfoPacket = makeZonePacket< FFXIVIpcContainerInfo >( m_pOwner->getId() );
|
||||||
containerInfoPacket.data().sequence = count;
|
containerInfoPacket->data().sequence = count;
|
||||||
containerInfoPacket.data().numItems = it->second->getEntryCount();
|
containerInfoPacket->data().numItems = it->second->getEntryCount();
|
||||||
containerInfoPacket.data().containerId = it->second->getId();
|
containerInfoPacket->data().containerId = it->second->getId();
|
||||||
m_pOwner->queuePacket( containerInfoPacket );
|
m_pOwner->queuePacket( containerInfoPacket );
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <Network/CommonNetwork.h>
|
#include <Network/CommonNetwork.h>
|
||||||
#include <Util/Util.h>
|
#include <Util/Util.h>
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include <Network/Acceptor.h>
|
#include <Network/Acceptor.h>
|
||||||
#include <Network/PacketContainer.h>
|
#include <Network/PacketContainer.h>
|
||||||
|
@ -179,7 +180,7 @@ void Core::Network::GameConnection::queueInPacket( Core::Network::Packets::FFXIV
|
||||||
m_inQueue.push( inPacket );
|
m_inQueue.push( inPacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Network::GameConnection::queueOutPacket( Core::Network::Packets::GamePacketPtr outPacket )
|
void Core::Network::GameConnection::queueOutPacket( Core::Network::Packets::FFXIVPacketBasePtr outPacket )
|
||||||
{
|
{
|
||||||
m_outQueue.push( outPacket );
|
m_outQueue.push( outPacket );
|
||||||
}
|
}
|
||||||
|
@ -311,7 +312,7 @@ void Core::Network::GameConnection::processOutQueue()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Network::GameConnection::sendSinglePacket( Packets::GamePacket* pPacket )
|
void Core::Network::GameConnection::sendSinglePacket( Core::Network::Packets::FFXIVPacketBasePtr pPacket )
|
||||||
{
|
{
|
||||||
PacketContainer pRP = PacketContainer();
|
PacketContainer pRP = PacketContainer();
|
||||||
pRP.addPacket( *pPacket );
|
pRP.addPacket( *pPacket );
|
||||||
|
@ -362,7 +363,8 @@ void Core::Network::GameConnection::injectPacket( const std::string& packetpath,
|
||||||
if( pSize == 0 )
|
if( pSize == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
queueOutPacket( GamePacketPtr( new GamePacket( packet + k, pSize, false ) ) );
|
// TODO: fix injection for new packets
|
||||||
|
//queueOutPacket( GamePacketPtr( new GamePacket( packet + k, pSize, false ) ) );
|
||||||
k += ( pSize );
|
k += ( pSize );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -412,32 +414,33 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
|
||||||
if( !m_pSession && session )
|
if( !m_pSession && session )
|
||||||
m_pSession = session;
|
m_pSession = session;
|
||||||
|
|
||||||
GamePacket pPe( 0x00, 0x18, 0, 0, 0x07 );
|
auto pe = boost::make_shared< FFXIVRawPacket >( 0x07, 0x18, 0, 0 );
|
||||||
//pPe.setValAt< uint32_t >( 0x10, 0xE0000005 );
|
*(unsigned int*)(&pe->data()[0]) = 0xE0037603;
|
||||||
pPe.setValAt< uint32_t >( 0x10, 0xE0037603 );
|
*(unsigned int*)(&pe->data()[4]) = static_cast< uint32_t >( time( nullptr ) );
|
||||||
pPe.setValAt< uint32_t >( 0x14, static_cast< uint32_t >( time( nullptr ) ) );
|
sendSinglePacket( pe );
|
||||||
sendSinglePacket( &pPe );
|
|
||||||
|
|
||||||
// main connection, assinging it to the session
|
// main connection, assinging it to the session
|
||||||
if( ipcHeader.connectionType == ConnectionType::Zone )
|
if( ipcHeader.connectionType == ConnectionType::Zone )
|
||||||
{
|
{
|
||||||
pPe = GamePacket( 0x00, 0x38, 0, 0, 0x02 );
|
auto pe1 = boost::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 );
|
||||||
pPe.setValAt< uint32_t >( 0x10, playerId );
|
*(unsigned int*)(&pe1->data()[0]) = playerId;
|
||||||
sendSinglePacket( &pPe );
|
sendSinglePacket( pe1 );
|
||||||
pLog->info( "[" + std::string( id ) + "] Setting session for zone connection" );
|
pLog->info( "[" + std::string( id ) + "] Setting session for zone connection" );
|
||||||
session->setZoneConnection( pCon );
|
session->setZoneConnection( pCon );
|
||||||
}
|
}
|
||||||
// chat connection, assinging it to the session
|
// chat connection, assinging it to the session
|
||||||
else if( ipcHeader.connectionType == ConnectionType::Chat )
|
else if( ipcHeader.connectionType == ConnectionType::Chat )
|
||||||
{
|
{
|
||||||
pPe = GamePacket( 0x00, 0x38, 0, 0, 0x02 );
|
auto pe2 = boost::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 );
|
||||||
pPe.setValAt< uint32_t >( 0x10, playerId );
|
*(unsigned int*)(&pe2->data()[0]) = playerId;
|
||||||
sendSinglePacket( &pPe );
|
sendSinglePacket( pe2 );
|
||||||
|
|
||||||
|
auto pe3 = boost::make_shared< FFXIVRawPacket >( 0x03, 0x28, playerId, playerId );
|
||||||
|
*(unsigned short*)(&pe3->data()[2]) = 0x02;
|
||||||
|
sendSinglePacket( pe3 );
|
||||||
|
|
||||||
pLog->info( "[" + std::string( id ) + "] Setting session for chat connection" );
|
pLog->info( "[" + std::string( id ) + "] Setting session for chat connection" );
|
||||||
session->setChatConnection( pCon );
|
session->setChatConnection( pCon );
|
||||||
pPe = GamePacket( 0x02, 0x28, playerId, playerId, 0x03 );
|
|
||||||
sendSinglePacket( &pPe );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -453,10 +456,10 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
|
||||||
uint32_t id = *( uint32_t* ) &inPacket.data[0];
|
uint32_t id = *( uint32_t* ) &inPacket.data[0];
|
||||||
uint32_t timeStamp = *( uint32_t* ) &inPacket.data[4];
|
uint32_t timeStamp = *( uint32_t* ) &inPacket.data[4];
|
||||||
|
|
||||||
GamePacket pPe( 0x00, 0x18, 0, 0, 0x08 );
|
auto pe4 = boost::make_shared< FFXIVRawPacket >( 0x08, 0x18, 0, 0 );
|
||||||
pPe.setValAt< uint32_t >( 0x10, id );
|
*(unsigned int*)(&pe4->data()[0]) = id;
|
||||||
pPe.setValAt< uint32_t >( 0x14, timeStamp );
|
*(unsigned int*)(&pe4->data()[4]) = timeStamp;
|
||||||
sendSinglePacket( &pPe );
|
sendSinglePacket( pe4 );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ private:
|
||||||
SessionPtr m_pSession;
|
SessionPtr m_pSession;
|
||||||
|
|
||||||
LockedQueue< Core::Network::Packets::FFXIVARR_PACKET_RAW > m_inQueue;
|
LockedQueue< Core::Network::Packets::FFXIVARR_PACKET_RAW > m_inQueue;
|
||||||
LockedQueue< Packets::GamePacketPtr > m_outQueue;
|
LockedQueue< Packets::FFXIVPacketBasePtr > m_outQueue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConnectionType m_conType;
|
ConnectionType m_conType;
|
||||||
|
@ -68,7 +68,7 @@ public:
|
||||||
const std::vector< Packets::FFXIVARR_PACKET_RAW >& packetData );
|
const std::vector< Packets::FFXIVARR_PACKET_RAW >& packetData );
|
||||||
|
|
||||||
void queueInPacket( Core::Network::Packets::FFXIVARR_PACKET_RAW inPacket );
|
void queueInPacket( Core::Network::Packets::FFXIVARR_PACKET_RAW inPacket );
|
||||||
void queueOutPacket( Packets::GamePacketPtr outPacket );
|
void queueOutPacket( Packets::FFXIVPacketBasePtr outPacket );
|
||||||
|
|
||||||
void processInQueue();
|
void processInQueue();
|
||||||
void processOutQueue();
|
void processOutQueue();
|
||||||
|
@ -81,7 +81,7 @@ public:
|
||||||
|
|
||||||
void sendPackets( Packets::PacketContainer* pPacket );
|
void sendPackets( Packets::PacketContainer* pPacket );
|
||||||
|
|
||||||
void sendSinglePacket( Packets::GamePacket* pPacket );
|
void sendSinglePacket( Core::Network::Packets::FFXIVPacketBasePtr pPacket );
|
||||||
|
|
||||||
void injectPacket( const std::string& packetpath, Entity::Player& player );
|
void injectPacket( const std::string& packetpath, Entity::Player& player );
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ void Core::Network::GameConnection::actionHandler( const Core::Network::Packets:
|
||||||
player.setAutoattack( false );
|
player.setAutoattack( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
player.sendToInRangeSet( ActorControlPacket142( player.getId(), 0, param11, 1 ) );
|
player.sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( player.getId(), 0, param11, 1 ) );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ void Core::Network::GameConnection::actionHandler( const Core::Network::Packets:
|
||||||
else
|
else
|
||||||
player.setAutoattack( false );
|
player.setAutoattack( false );
|
||||||
|
|
||||||
player.sendToInRangeSet( ActorControlPacket142( player.getId(), 1, param11, 1 ) );
|
player.sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( player.getId(), 1, param11, 1 ) );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,19 +29,17 @@ using namespace Core::Network::Packets::Server;
|
||||||
void Core::Network::GameConnection::cfDutyInfoRequest( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::cfDutyInfoRequest( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcCFDutyInfo > dutyInfoPacket( player.getId() );
|
auto dutyInfoPacket = makeZonePacket< FFXIVIpcCFDutyInfo >( player.getId() );
|
||||||
|
|
||||||
auto penaltyMinutes = player.getCFPenaltyMinutes();
|
auto penaltyMinutes = player.getCFPenaltyMinutes();
|
||||||
if( penaltyMinutes > 255 )
|
if( penaltyMinutes > 255 )
|
||||||
{
|
{
|
||||||
// cap it since it's uint8_t in packets
|
// cap it since it's uint8_t in packets
|
||||||
penaltyMinutes = 255;
|
penaltyMinutes = 255;
|
||||||
}
|
}
|
||||||
dutyInfoPacket.data().penaltyTime = penaltyMinutes;
|
dutyInfoPacket->data().penaltyTime = penaltyMinutes;
|
||||||
|
|
||||||
queueOutPacket( dutyInfoPacket );
|
queueOutPacket( dutyInfoPacket );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcCFPlayerInNeed > inNeedsPacket( player.getId() );
|
auto inNeedsPacket = makeZonePacket< FFXIVIpcCFPlayerInNeed >( player.getId() );
|
||||||
queueOutPacket( inNeedsPacket );
|
queueOutPacket( inNeedsPacket );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -73,9 +71,9 @@ void Core::Network::GameConnection::cfRegisterDuty( const Packets::FFXIVARR_PACK
|
||||||
player.sendDebug( "Duty register request for contentid: " + std::to_string( contentId ) );
|
player.sendDebug( "Duty register request for contentid: " + std::to_string( contentId ) );
|
||||||
|
|
||||||
// let's cancel it because otherwise you can't register it again
|
// let's cancel it because otherwise you can't register it again
|
||||||
ZoneChannelPacket< FFXIVIpcCFNotify > cfCancelPacket( player.getId() );
|
auto cfCancelPacket = makeZonePacket< FFXIVIpcCFNotify >( player.getId() );
|
||||||
cfCancelPacket.data().state1 = 3;
|
cfCancelPacket->data().state1 = 3;
|
||||||
cfCancelPacket.data().state2 = 1; // Your registration is withdrawn.
|
cfCancelPacket->data().state2 = 1; // Your registration is withdrawn.
|
||||||
queueOutPacket( cfCancelPacket );
|
queueOutPacket( cfCancelPacket );
|
||||||
|
|
||||||
auto cfCondition = pExdData->get< Core::Data::ContentFinderCondition >( contentId );
|
auto cfCondition = pExdData->get< Core::Data::ContentFinderCondition >( contentId );
|
||||||
|
@ -97,9 +95,9 @@ void Core::Network::GameConnection::cfRegisterDuty( const Packets::FFXIVARR_PACK
|
||||||
void Core::Network::GameConnection::cfRegisterRoulette( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::cfRegisterRoulette( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player)
|
Entity::Player& player)
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcCFNotify > cfCancelPacket( player.getId() );
|
auto cfCancelPacket = makeZonePacket< FFXIVIpcCFNotify >( player.getId() );
|
||||||
cfCancelPacket.data().state1 = 3;
|
cfCancelPacket->data().state1 = 3;
|
||||||
cfCancelPacket.data().state2 = 1; // Your registration is withdrawn.
|
cfCancelPacket->data().state2 = 1; // Your registration is withdrawn.
|
||||||
queueOutPacket( cfCancelPacket );
|
queueOutPacket( cfCancelPacket );
|
||||||
|
|
||||||
player.sendDebug( "Roulette register" );
|
player.sendDebug( "Roulette register" );
|
||||||
|
|
|
@ -250,11 +250,11 @@ void Core::Network::GameConnection::eventHandlerLinkshell( const Packets::FFXIVA
|
||||||
auto scene = *reinterpret_cast< uint16_t* >( ©.data[0x14] );
|
auto scene = *reinterpret_cast< uint16_t* >( ©.data[0x14] );
|
||||||
auto lsName = std::string( reinterpret_cast< char* >( ©.data[0x17] ) );
|
auto lsName = std::string( reinterpret_cast< char* >( ©.data[0x17] ) );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcEventLinkshell > linkshellEvent( player.getId() );
|
auto linkshellEvent = makeZonePacket< FFXIVIpcEventLinkshell >( player.getId() );
|
||||||
linkshellEvent.data().eventId = eventId;
|
linkshellEvent->data().eventId = eventId;
|
||||||
linkshellEvent.data().scene = static_cast< uint8_t >( scene );
|
linkshellEvent->data().scene = static_cast< uint8_t >( scene );
|
||||||
linkshellEvent.data().param3 = 1;
|
linkshellEvent->data().param3 = 1;
|
||||||
linkshellEvent.data().unknown1 = 0x15a;
|
linkshellEvent->data().unknown1 = 0x15a;
|
||||||
player.queuePacket( linkshellEvent );
|
player.queuePacket( linkshellEvent );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R
|
||||||
}
|
}
|
||||||
case GmCommand::Speed:
|
case GmCommand::Speed:
|
||||||
{
|
{
|
||||||
targetPlayer->queuePacket( ActorControlPacket143( player.getId(), Flee, param1 ) );
|
targetPlayer->queuePacket( boost::make_shared< ActorControlPacket143 >( player.getId(), Flee, param1 ) );
|
||||||
player.sendNotice( "Speed for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
player.sendNotice( "Speed for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -233,17 +233,17 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R
|
||||||
{
|
{
|
||||||
targetPlayer->setOnlineStatusMask( param1 );
|
targetPlayer->setOnlineStatusMask( param1 );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcSetOnlineStatus > statusPacket( targetPlayer->getId() );
|
auto statusPacket = makeZonePacket< FFXIVIpcSetOnlineStatus >( player.getId() );
|
||||||
statusPacket.data().onlineStatusFlags = param1;
|
statusPacket->data().onlineStatusFlags = param1;
|
||||||
queueOutPacket( statusPacket );
|
queueOutPacket( statusPacket );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcSetSearchInfo > searchInfoPacket( targetPlayer->getId() );
|
auto searchInfoPacket = makeZonePacket< FFXIVIpcSetSearchInfo >( player.getId() );
|
||||||
searchInfoPacket.data().onlineStatusFlags = param1;
|
searchInfoPacket->data().onlineStatusFlags = param1;
|
||||||
searchInfoPacket.data().selectRegion = targetPlayer->getSearchSelectRegion();
|
searchInfoPacket->data().selectRegion = targetPlayer->getSearchSelectRegion();
|
||||||
strcpy( searchInfoPacket.data().searchMessage, targetPlayer->getSearchMessage() );
|
strcpy( searchInfoPacket->data().searchMessage, targetPlayer->getSearchMessage() );
|
||||||
targetPlayer->queuePacket( searchInfoPacket );
|
targetPlayer->queuePacket( searchInfoPacket );
|
||||||
|
|
||||||
targetPlayer->sendToInRangeSet( ActorControlPacket142( player.getId(), SetStatusIcon,
|
targetPlayer->sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( player.getId(), SetStatusIcon,
|
||||||
static_cast< uint8_t >( player.getOnlineStatus() ) ),
|
static_cast< uint8_t >( player.getOnlineStatus() ) ),
|
||||||
true );
|
true );
|
||||||
player.sendNotice( "Icon for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
player.sendNotice( "Icon for " + targetPlayer->getName() + " was set to " + std::to_string( param1 ) );
|
||||||
|
@ -526,8 +526,8 @@ void Core::Network::GameConnection::gm2Handler( const Packets::FFXIVARR_PACKET_R
|
||||||
targetPlayer->resetMp();
|
targetPlayer->resetMp();
|
||||||
targetPlayer->setStatus( Entity::Chara::ActorStatus::Idle );
|
targetPlayer->setStatus( Entity::Chara::ActorStatus::Idle );
|
||||||
|
|
||||||
targetPlayer->sendToInRangeSet( ActorControlPacket143( player.getId(), ZoneIn, 0x01, 0x01, 0, 113 ), true );
|
targetPlayer->sendToInRangeSet( boost::make_shared< ActorControlPacket143 >( player.getId(), ZoneIn, 0x01, 0x01, 0, 113 ), true );
|
||||||
targetPlayer->sendToInRangeSet( ActorControlPacket142( player.getId(), SetStatus,
|
targetPlayer->sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( player.getId(), SetStatus,
|
||||||
static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle ) ), true );
|
static_cast< uint8_t >( Entity::Chara::ActorStatus::Idle ) ), true );
|
||||||
player.sendNotice( "Raised " + targetPlayer->getName() );
|
player.sendNotice( "Raised " + targetPlayer->getName() );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -53,9 +53,9 @@ void Core::Network::GameConnection::inventoryModifyHandler( const Packets::FFXIV
|
||||||
// todo: check packet handler in game and see if this is sent as a u16 or u32
|
// todo: check packet handler in game and see if this is sent as a u16 or u32
|
||||||
auto splitCount = *reinterpret_cast< uint16_t* >( ©.data[0x38] );
|
auto splitCount = *reinterpret_cast< uint16_t* >( ©.data[0x38] );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcInventoryActionAck > ackPacket( player.getId() );
|
auto ackPacket = makeZonePacket< FFXIVIpcInventoryActionAck >( player.getId() );
|
||||||
ackPacket.data().sequence = seq;
|
ackPacket->data().sequence = seq;
|
||||||
ackPacket.data().type = 7;
|
ackPacket->data().type = 7;
|
||||||
player.queuePacket( ackPacket );
|
player.queuePacket( ackPacket );
|
||||||
|
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = g_fw.get< Logger >();
|
||||||
|
|
|
@ -76,34 +76,34 @@ void Core::Network::GameConnection::setSearchInfoHandler( const Packets::FFXIVAR
|
||||||
// mark player as new adventurer
|
// mark player as new adventurer
|
||||||
player.setNewAdventurer( true );
|
player.setNewAdventurer( true );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcSetOnlineStatus > statusPacket( player.getId() );
|
auto statusPacket = makeZonePacket< FFXIVIpcSetOnlineStatus >( player.getId() );
|
||||||
statusPacket.data().onlineStatusFlags = status;
|
statusPacket->data().onlineStatusFlags = status;
|
||||||
queueOutPacket( statusPacket );
|
queueOutPacket( statusPacket );
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcSetSearchInfo > searchInfoPacket( player.getId() );
|
auto searchInfoPacket = makeZonePacket< FFXIVIpcSetSearchInfo >( player.getId() );
|
||||||
searchInfoPacket.data().onlineStatusFlags = status;
|
searchInfoPacket->data().onlineStatusFlags = status;
|
||||||
searchInfoPacket.data().selectRegion = player.getSearchSelectRegion();
|
searchInfoPacket->data().selectRegion = player.getSearchSelectRegion();
|
||||||
strcpy( searchInfoPacket.data().searchMessage, player.getSearchMessage() );
|
strcpy( searchInfoPacket->data().searchMessage, player.getSearchMessage() );
|
||||||
queueOutPacket( searchInfoPacket );
|
queueOutPacket( searchInfoPacket );
|
||||||
|
|
||||||
player.sendToInRangeSet( ActorControlPacket142( player.getId(), SetStatusIcon,
|
player.sendToInRangeSet( boost::make_shared< ActorControlPacket142 >( player.getId(), SetStatusIcon,
|
||||||
static_cast< uint8_t >( player.getOnlineStatus() ) ), true );
|
static_cast< uint8_t >( player.getOnlineStatus() ) ), true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Network::GameConnection::reqSearchInfoHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::reqSearchInfoHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcInitSearchInfo > searchInfoPacket( player.getId() );
|
auto searchInfoPacket = makeZonePacket< FFXIVIpcInitSearchInfo >( player.getId() );
|
||||||
searchInfoPacket.data().onlineStatusFlags = player.getOnlineStatusMask();
|
searchInfoPacket->data().onlineStatusFlags = player.getOnlineStatusMask();
|
||||||
searchInfoPacket.data().selectRegion = player.getSearchSelectRegion();
|
searchInfoPacket->data().selectRegion = player.getSearchSelectRegion();
|
||||||
strcpy( searchInfoPacket.data().searchMessage, player.getSearchMessage() );
|
strcpy( searchInfoPacket->data().searchMessage, player.getSearchMessage() );
|
||||||
queueOutPacket( searchInfoPacket );
|
queueOutPacket( searchInfoPacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Network::GameConnection::linkshellListHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::linkshellListHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcLinkshellList > linkshellListPacket( player.getId() );
|
auto linkshellListPacket = makeZonePacket< FFXIVIpcLinkshellList >( player.getId() );
|
||||||
queueOutPacket( linkshellListPacket );
|
queueOutPacket( linkshellListPacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ void Core::Network::GameConnection::updatePositionHandler( const Core::Network::
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveActorPacket movePacket( player, unk1, unk2, unk3, unk4 );
|
auto movePacket = boost::make_shared< MoveActorPacket >( player, unk1, unk2, unk3, unk4 );
|
||||||
player.sendToInRangeSet( movePacket );
|
player.sendToInRangeSet( movePacket );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -317,8 +317,8 @@ void Core::Network::GameConnection::zoneLineHandler( const Core::Network::Packet
|
||||||
targetZone = pLine->getTargetZoneId();
|
targetZone = pLine->getTargetZoneId();
|
||||||
rotation = pLine->getTargetRotation();
|
rotation = pLine->getTargetRotation();
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcPrepareZoning > preparePacket( player.getId() );
|
auto preparePacket = makeZonePacket< FFXIVIpcPrepareZoning >( player.getId() );
|
||||||
preparePacket.data().targetZone = targetZone;
|
preparePacket->data().targetZone = targetZone;
|
||||||
|
|
||||||
//ActorControlPacket143 controlPacket( pPlayer, ActorControlType::DespawnZoneScreenMsg,
|
//ActorControlPacket143 controlPacket( pPlayer, ActorControlType::DespawnZoneScreenMsg,
|
||||||
// 0x03, player.getId(), 0x01, targetZone );
|
// 0x03, player.getId(), 0x01, targetZone );
|
||||||
|
@ -358,9 +358,9 @@ void Core::Network::GameConnection::discoveryHandler( const Core::Network::Packe
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcDiscovery > discoveryPacket( player.getId() );
|
auto discoveryPacket = makeZonePacket< FFXIVIpcDiscovery >( player.getId() );
|
||||||
discoveryPacket.data().map_id = pQR->getUInt( 2 );
|
discoveryPacket->data().map_id = pQR->getUInt( 2 );
|
||||||
discoveryPacket.data().map_part_id = pQR->getUInt( 3 );
|
discoveryPacket->data().map_part_id = pQR->getUInt( 3 );
|
||||||
|
|
||||||
player.queuePacket( discoveryPacket );
|
player.queuePacket( discoveryPacket );
|
||||||
player.sendNotice( "Discovery ref pos ID: " + std::to_string( ref_position_id ) );
|
player.sendNotice( "Discovery ref pos ID: " + std::to_string( ref_position_id ) );
|
||||||
|
@ -373,8 +373,8 @@ void Core::Network::GameConnection::discoveryHandler( const Core::Network::Packe
|
||||||
void Core::Network::GameConnection::playTimeHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::playTimeHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcPlayTime > playTimePacket( player.getId() );
|
auto playTimePacket = makeZonePacket< FFXIVIpcPlayTime >( player.getId() );
|
||||||
playTimePacket.data().playTimeInMinutes = player.getPlayTime() / 60;
|
playTimePacket->data().playTimeInMinutes = player.getPlayTime() / 60;
|
||||||
player.queuePacket( playTimePacket );
|
player.queuePacket( playTimePacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,8 +394,8 @@ void Core::Network::GameConnection::blackListHandler( const Core::Network::Packe
|
||||||
{
|
{
|
||||||
uint8_t count = inPacket.data[0x11];
|
uint8_t count = inPacket.data[0x11];
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcBlackList > blackListPacket( player.getId() );
|
auto blackListPacket = makeZonePacket< FFXIVIpcBlackList >( player.getId() );
|
||||||
blackListPacket.data().sequence = count;
|
blackListPacket->data().sequence = count;
|
||||||
// TODO: Fill with actual blacklist data
|
// TODO: Fill with actual blacklist data
|
||||||
//blackListPacket.data().entry[0].contentId = 1;
|
//blackListPacket.data().entry[0].contentId = 1;
|
||||||
//sprintf( blackListPacket.data().entry[0].name, "Test Test" );
|
//sprintf( blackListPacket.data().entry[0].name, "Test Test" );
|
||||||
|
@ -410,8 +410,7 @@ void Core::Network::GameConnection::pingHandler( const Core::Network::Packets::F
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
||||||
auto inVal = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
auto inVal = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
||||||
|
|
||||||
PingPacket pingPacket( player, inVal );
|
queueOutPacket( boost::make_shared< PingPacket>( player, inVal ) );
|
||||||
queueOutPacket( pingPacket );
|
|
||||||
|
|
||||||
player.setLastPing( static_cast< uint32_t >( time( nullptr ) ) );
|
player.setLastPing( static_cast< uint32_t >( time( nullptr ) ) );
|
||||||
}
|
}
|
||||||
|
@ -450,45 +449,44 @@ void Core::Network::GameConnection::socialListHandler( const Core::Network::Pack
|
||||||
if( type == 0x02 )
|
if( type == 0x02 )
|
||||||
{ // party list
|
{ // party list
|
||||||
|
|
||||||
ZoneChannelPacket< FFXIVIpcSocialList > listPacket( player.getId() );
|
auto listPacket = makeZonePacket< FFXIVIpcSocialList >( player.getId() );
|
||||||
|
|
||||||
listPacket.data().type = 2;
|
listPacket->data().type = 2;
|
||||||
listPacket.data().sequence = count;
|
listPacket->data().sequence = count;
|
||||||
|
|
||||||
int32_t entrysizes = sizeof( listPacket.data().entries );
|
int32_t entrysizes = sizeof( listPacket->data().entries );
|
||||||
memset( listPacket.data().entries, 0, sizeof( listPacket.data().entries ) );
|
memset( listPacket->data().entries, 0, sizeof( listPacket->data().entries ) );
|
||||||
|
|
||||||
listPacket.data().entries[0].bytes[2] = player.getCurrentZone()->getTerritoryId();
|
listPacket->data().entries[0].bytes[2] = player.getCurrentZone()->getTerritoryId();
|
||||||
listPacket.data().entries[0].bytes[3] = 0x80;
|
listPacket->data().entries[0].bytes[3] = 0x80;
|
||||||
listPacket.data().entries[0].bytes[4] = 0x02;
|
listPacket->data().entries[0].bytes[4] = 0x02;
|
||||||
listPacket.data().entries[0].bytes[6] = 0x3B;
|
listPacket->data().entries[0].bytes[6] = 0x3B;
|
||||||
listPacket.data().entries[0].bytes[11] = 0x10;
|
listPacket->data().entries[0].bytes[11] = 0x10;
|
||||||
listPacket.data().entries[0].classJob = static_cast< uint8_t >( player.getClass() );
|
listPacket->data().entries[0].classJob = static_cast< uint8_t >( player.getClass() );
|
||||||
listPacket.data().entries[0].contentId = player.getContentId();
|
listPacket->data().entries[0].contentId = player.getContentId();
|
||||||
listPacket.data().entries[0].level = player.getLevel();
|
listPacket->data().entries[0].level = player.getLevel();
|
||||||
listPacket.data().entries[0].zoneId = player.getCurrentZone()->getTerritoryId();
|
listPacket->data().entries[0].zoneId = player.getCurrentZone()->getTerritoryId();
|
||||||
listPacket.data().entries[0].zoneId1 = 0x0100;
|
listPacket->data().entries[0].zoneId1 = 0x0100;
|
||||||
// TODO: no idea what this does
|
// TODO: no idea what this does
|
||||||
//listPacket.data().entries[0].one = 1;
|
//listPacket.data().entries[0].one = 1;
|
||||||
|
|
||||||
memcpy( listPacket.data().entries[0].name, player.getName().c_str(), strlen( player.getName().c_str() ) );
|
memcpy( listPacket->data().entries[0].name, player.getName().c_str(), strlen( player.getName().c_str() ) );
|
||||||
|
|
||||||
// TODO: actually store and read language from somewhere
|
// TODO: actually store and read language from somewhere
|
||||||
listPacket.data().entries[0].bytes1[0] = 0x01;//flags (lang)
|
listPacket->data().entries[0].bytes1[0] = 0x01;//flags (lang)
|
||||||
// TODO: these flags need to be figured out
|
// TODO: these flags need to be figured out
|
||||||
//listPacket.data().entries[0].bytes1[1] = 0x00;//flags
|
//listPacket.data().entries[0].bytes1[1] = 0x00;//flags
|
||||||
listPacket.data().entries[0].onlineStatusMask = player.getOnlineStatusMask();
|
listPacket->data().entries[0].onlineStatusMask = player.getOnlineStatusMask();
|
||||||
|
|
||||||
queueOutPacket( listPacket );
|
queueOutPacket( listPacket );
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( type == 0x0b )
|
else if( type == 0x0b )
|
||||||
{ // friend list
|
{ // friend list
|
||||||
|
auto listPacket = makeZonePacket< FFXIVIpcSocialList >( player.getId() );
|
||||||
ZoneChannelPacket< FFXIVIpcSocialList > listPacket( player.getId() );
|
listPacket->data().type = 0x0B;
|
||||||
listPacket.data().type = 0x0B;
|
listPacket->data().sequence = count;
|
||||||
listPacket.data().sequence = count;
|
memset( listPacket->data().entries, 0, sizeof( listPacket->data().entries ) );
|
||||||
memset( listPacket.data().entries, 0, sizeof( listPacket.data().entries ) );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( type == 0x0e )
|
else if( type == 0x0e )
|
||||||
|
@ -519,14 +517,14 @@ void Core::Network::GameConnection::chatHandler( const Core::Network::Packets::F
|
||||||
ChatType chatType = static_cast< ChatType >( inPacket.data[0x28] );
|
ChatType chatType = static_cast< ChatType >( inPacket.data[0x28] );
|
||||||
|
|
||||||
//ToDo, need to implement sending GM chat types.
|
//ToDo, need to implement sending GM chat types.
|
||||||
ChatPacket chatPacket( player, chatType, chatString );
|
auto chatPacket = boost::make_shared< ChatPacket >( player, chatType, chatString );
|
||||||
|
|
||||||
switch( chatType )
|
switch( chatType )
|
||||||
{
|
{
|
||||||
case ChatType::Say:
|
case ChatType::Say:
|
||||||
{
|
{
|
||||||
if (player.getGmRank() > 0)
|
if (player.getGmRank() > 0)
|
||||||
chatPacket.data().chatType = ChatType::GMSay;
|
chatPacket->data().chatType = ChatType::GMSay;
|
||||||
|
|
||||||
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
player.getCurrentZone()->queueOutPacketForRange( player, 50, chatPacket );
|
||||||
break;
|
break;
|
||||||
|
@ -534,7 +532,7 @@ void Core::Network::GameConnection::chatHandler( const Core::Network::Packets::F
|
||||||
case ChatType::Yell:
|
case ChatType::Yell:
|
||||||
{
|
{
|
||||||
if( player.getGmRank() > 0 )
|
if( player.getGmRank() > 0 )
|
||||||
chatPacket.data().chatType = ChatType::GMYell;
|
chatPacket->data().chatType = ChatType::GMYell;
|
||||||
|
|
||||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||||
break;
|
break;
|
||||||
|
@ -542,7 +540,7 @@ void Core::Network::GameConnection::chatHandler( const Core::Network::Packets::F
|
||||||
case ChatType::Shout:
|
case ChatType::Shout:
|
||||||
{
|
{
|
||||||
if( player.getGmRank() > 0 )
|
if( player.getGmRank() > 0 )
|
||||||
chatPacket.data().chatType = ChatType::GMShout;
|
chatPacket->data().chatType = ChatType::GMShout;
|
||||||
|
|
||||||
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
player.getCurrentZone()->queueOutPacketForRange( player, 6000, chatPacket );
|
||||||
break;
|
break;
|
||||||
|
@ -563,9 +561,9 @@ void Core::Network::GameConnection::chatHandler( const Core::Network::Packets::F
|
||||||
void Core::Network::GameConnection::logoutHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::logoutHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcLogout > logoutPacket( player.getId() );
|
auto logoutPacket = makeZonePacket< FFXIVIpcLogout >( player.getId() );
|
||||||
logoutPacket.data().flags1 = 0x02;
|
logoutPacket->data().flags1 = 0x02;
|
||||||
logoutPacket.data().flags2 = 0x2000;
|
logoutPacket->data().flags2 = 0x2000;
|
||||||
queueOutPacket( logoutPacket );
|
queueOutPacket( logoutPacket );
|
||||||
|
|
||||||
player.setMarkedForRemoval();
|
player.setMarkedForRemoval();
|
||||||
|
@ -586,8 +584,8 @@ void Core::Network::GameConnection::tellHandler( const Core::Network::Packets::F
|
||||||
|
|
||||||
if( !pSession )
|
if( !pSession )
|
||||||
{
|
{
|
||||||
ChatChannelPacket< FFXIVIpcTellErrNotFound > tellErrPacket( player.getId() );
|
auto tellErrPacket = makeZonePacket< FFXIVIpcTellErrNotFound >( player.getId() );
|
||||||
strcpy( tellErrPacket.data().receipientName, targetPcName.c_str() );
|
strcpy( tellErrPacket->data().receipientName, targetPcName.c_str() );
|
||||||
sendSinglePacket( tellErrPacket );
|
sendSinglePacket( tellErrPacket );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -615,9 +613,9 @@ void Core::Network::GameConnection::tellHandler( const Core::Network::Packets::F
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatChannelPacket< FFXIVIpcTell > tellPacket( player.getId() );
|
auto tellPacket = makeChatPacket< FFXIVIpcTell >( player.getId() );
|
||||||
strcpy( tellPacket.data().msg, msg.c_str() );
|
strcpy( tellPacket->data().msg, msg.c_str() );
|
||||||
strcpy( tellPacket.data().receipientName, player.getName().c_str() );
|
strcpy( tellPacket->data().receipientName, player.getName().c_str() );
|
||||||
// TODO: do these have a meaning?
|
// TODO: do these have a meaning?
|
||||||
//tellPacket.data().u1 = 0x92CD7337;
|
//tellPacket.data().u1 = 0x92CD7337;
|
||||||
//tellPacket.data().u2a = 0x2E;
|
//tellPacket.data().u2a = 0x2E;
|
||||||
|
@ -629,9 +627,7 @@ void Core::Network::GameConnection::tellHandler( const Core::Network::Packets::F
|
||||||
void Core::Network::GameConnection::performNoteHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::performNoteHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcPerformNote > performPacket( player.getId() );
|
auto performPacket = makeZonePacket< FFXIVIpcPerformNote >( player.getId() );
|
||||||
|
memcpy( &performPacket->data().data[0], &inPacket.data[0x10], 32 );
|
||||||
memcpy( &performPacket.data().data[0], &inPacket.data[0x10], 32 );
|
|
||||||
|
|
||||||
player.sendToInRangeSet( performPacket );
|
player.sendToInRangeSet( performPacket );
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ void Core::Network::GameConnection::skillHandler( const Packets::FFXIVARR_PACKET
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
||||||
|
|
||||||
uint8_t type = inPacket.data[0x11];
|
uint8_t type = inPacket.data[0x11];
|
||||||
|
|
||||||
auto action = *reinterpret_cast< uint32_t* >( ©.data[0x14] );
|
auto action = *reinterpret_cast< uint32_t* >( ©.data[0x14] );
|
||||||
|
@ -62,7 +62,7 @@ void Core::Network::GameConnection::skillHandler( const Packets::FFXIVARR_PACKET
|
||||||
pExdData->get< Core::Data::Action >( action )->name +
|
pExdData->get< Core::Data::Action >( action )->name +
|
||||||
" | " + std::to_string( targetId ) + " )" );
|
" | " + std::to_string( targetId ) + " )" );
|
||||||
|
|
||||||
player.queuePacket( ActorControlPacket142( player.getId(), ActorControlType::ActionStart, 0x01, action ) );
|
player.queuePacket( boost::make_shared< ActorControlPacket142 >( player.getId(), ActorControlType::ActionStart, 0x01, action ) );
|
||||||
|
|
||||||
if( action == 5 )
|
if( action == 5 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,11 +19,12 @@ namespace Server {
|
||||||
* @brief The packet sent to spawn a player.
|
* @brief The packet sent to spawn a player.
|
||||||
*/
|
*/
|
||||||
class PlayerSpawnPacket :
|
class PlayerSpawnPacket :
|
||||||
public GamePacketNew< FFXIVIpcPlayerSpawn, ServerZoneIpcType >
|
public ZoneChannelPacket< FFXIVIpcPlayerSpawn >
|
||||||
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlayerSpawnPacket( Entity::Player& player, Entity::Player& target ) :
|
PlayerSpawnPacket( Entity::Player& player, Entity::Player& target ) :
|
||||||
GamePacketNew< FFXIVIpcPlayerSpawn, ServerZoneIpcType >( player.getId(), target.getId() )
|
ZoneChannelPacket< FFXIVIpcPlayerSpawn >( player.getId(), target.getId() )
|
||||||
{
|
{
|
||||||
initialize( player, target );
|
initialize( player, target );
|
||||||
};
|
};
|
||||||
|
|
|
@ -133,7 +133,7 @@ void Core::InstanceContent::onUpdate( uint32_t currTime )
|
||||||
{
|
{
|
||||||
auto pPlayer = playerIt.second;
|
auto pPlayer = playerIt.second;
|
||||||
pPlayer->queuePacket(
|
pPlayer->queuePacket(
|
||||||
ActorControlPacket143( pPlayer->getId(), DirectorUpdate,
|
boost::make_shared< ActorControlPacket143 >( pPlayer->getId(), DirectorUpdate,
|
||||||
getDirectorId(), 0x40000001, m_instanceConfiguration->timeLimitmin * 60u ) );
|
getDirectorId(), 0x40000001, m_instanceConfiguration->timeLimitmin * 60u ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ void Core::InstanceContent::onInitDirector( Entity::Player& player )
|
||||||
|
|
||||||
void Core::InstanceContent::onSomeDirectorEvent( Entity::Player& player )
|
void Core::InstanceContent::onSomeDirectorEvent( Entity::Player& player )
|
||||||
{
|
{
|
||||||
player.queuePacket( ActorControlPacket143( player.getId(), DirectorUpdate, 0x00110001, 0x80000000, 1 ) );
|
player.queuePacket( boost::make_shared< ActorControlPacket143 >( player.getId(), DirectorUpdate, 0x00110001, 0x80000000, 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ void Core::InstanceContent::startQte()
|
||||||
for( const auto& playerIt : m_playerMap )
|
for( const auto& playerIt : m_playerMap )
|
||||||
{
|
{
|
||||||
auto player = playerIt.second;
|
auto player = playerIt.second;
|
||||||
player->queuePacket( ActorControlPacket143( player->getId(), DirectorUpdate, getDirectorId(), 0x8000000A ) );
|
player->queuePacket( boost::make_shared< ActorControlPacket143 >( player->getId(), DirectorUpdate, getDirectorId(), 0x8000000A ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ void Core::InstanceContent::startEventCutscene()
|
||||||
for( const auto& playerIt : m_playerMap )
|
for( const auto& playerIt : m_playerMap )
|
||||||
{
|
{
|
||||||
auto player = playerIt.second;
|
auto player = playerIt.second;
|
||||||
player->queuePacket( ActorControlPacket143( player->getId(), DirectorUpdate, getDirectorId(), 0x80000008 ) );
|
player->queuePacket( boost::make_shared< ActorControlPacket143 >( player->getId(), DirectorUpdate, getDirectorId(), 0x80000008 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ void Core::InstanceContent::endEventCutscene()
|
||||||
for( const auto& playerIt : m_playerMap )
|
for( const auto& playerIt : m_playerMap )
|
||||||
{
|
{
|
||||||
auto player = playerIt.second;
|
auto player = playerIt.second;
|
||||||
player->queuePacket( ActorControlPacket143( player->getId(), DirectorUpdate, getDirectorId(), 0x80000009 ) );
|
player->queuePacket( boost::make_shared< ActorControlPacket143 >( player->getId(), DirectorUpdate, getDirectorId(), 0x80000009 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,13 +409,13 @@ void Core::InstanceContent::setCurrentBGM( uint16_t bgmIndex )
|
||||||
// note: retail do send a BGM_MUTE(1) first before any BGM transition, but YOLO in this case.
|
// note: retail do send a BGM_MUTE(1) first before any BGM transition, but YOLO in this case.
|
||||||
// also do note that this code can't control the bgm granularly. (i.e. per player for WoD submap.) oops.
|
// also do note that this code can't control the bgm granularly. (i.e. per player for WoD submap.) oops.
|
||||||
// player->queuePacket( ActorControlPacket143( player->getId(), DirectorUpdate, getDirectorId(), 0x80000001, 1 ) );
|
// player->queuePacket( ActorControlPacket143( player->getId(), DirectorUpdate, getDirectorId(), 0x80000001, 1 ) );
|
||||||
player->queuePacket( ActorControlPacket143( player->getId(), DirectorUpdate, getDirectorId(), 0x80000001, bgmIndex ) );
|
player->queuePacket( boost::make_shared< ActorControlPacket143 >( player->getId(), DirectorUpdate, getDirectorId(), 0x80000001, bgmIndex ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::InstanceContent::setPlayerBGM( Core::Entity::Player& player, uint16_t bgmId )
|
void Core::InstanceContent::setPlayerBGM( Core::Entity::Player& player, uint16_t bgmId )
|
||||||
{
|
{
|
||||||
player.queuePacket( ActorControlPacket143( player.getId(), DirectorUpdate, getDirectorId(), 0x80000001, bgmId ) );
|
player.queuePacket( boost::make_shared< ActorControlPacket143 >( player.getId(), DirectorUpdate, getDirectorId(), 0x80000001, bgmId ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Core::InstanceContent::getCurrentBGM() const
|
uint16_t Core::InstanceContent::getCurrentBGM() const
|
||||||
|
|
|
@ -142,7 +142,7 @@ void Core::Zone::setCurrentFestival( uint16_t festivalId )
|
||||||
{
|
{
|
||||||
auto player = playerEntry.second;
|
auto player = playerEntry.second;
|
||||||
|
|
||||||
ActorControlPacket143 enableFestival( player->getId(), SetFestival, m_currentFestivalId );
|
auto enableFestival = boost::make_shared< ActorControlPacket143 >( player->getId(), SetFestival, m_currentFestivalId );
|
||||||
playerEntry.second->queuePacket( enableFestival );
|
playerEntry.second->queuePacket( enableFestival );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,8 @@ void Core::Zone::removeActor( Entity::ActorPtr pActor )
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Zone::queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t range, GamePacketPtr pPacketEntry )
|
void Core::Zone::queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t range,
|
||||||
|
Network::Packets::FFXIVPacketBasePtr pPacketEntry )
|
||||||
{
|
{
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||||
if( pTeriMgr->isPrivateTerritory( getTerritoryId() ) )
|
if( pTeriMgr->isPrivateTerritory( getTerritoryId() ) )
|
||||||
|
@ -286,7 +287,7 @@ void Core::Zone::queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t
|
||||||
{
|
{
|
||||||
|
|
||||||
auto pSession = pServerZone->getSession( player->getId() );
|
auto pSession = pServerZone->getSession( player->getId() );
|
||||||
pPacketEntry->setValAt< uint32_t >( 0x08, player->getId() );
|
//pPacketEntry->setValAt< uint32_t >( 0x08, player->getId() );
|
||||||
if( pSession )
|
if( pSession )
|
||||||
pSession->getZoneConnection()->queueOutPacket( pPacketEntry );
|
pSession->getZoneConnection()->queueOutPacket( pPacketEntry );
|
||||||
}
|
}
|
||||||
|
@ -433,9 +434,9 @@ void Core::Zone::updateSessions( bool changedWeather )
|
||||||
|
|
||||||
if( changedWeather )
|
if( changedWeather )
|
||||||
{
|
{
|
||||||
ZoneChannelPacket< FFXIVIpcWeatherChange > weatherChangePacket( pPlayer->getId() );
|
auto weatherChangePacket = makeZonePacket< FFXIVIpcWeatherChange >(pPlayer->getId() );
|
||||||
weatherChangePacket.data().weatherId = static_cast< uint8_t >( m_currentWeather );
|
weatherChangePacket->data().weatherId = static_cast< uint8_t >( m_currentWeather );
|
||||||
weatherChangePacket.data().delay = 5.0f;
|
weatherChangePacket->data().delay = 5.0f;
|
||||||
pSession->getPlayer()->queuePacket( weatherChangePacket );
|
pSession->getPlayer()->queuePacket( weatherChangePacket );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ public:
|
||||||
|
|
||||||
void updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell );
|
void updateInRangeSet( Entity::ActorPtr pActor, Cell* pCell );
|
||||||
|
|
||||||
void queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t range, Network::Packets::GamePacketPtr pPacketEntry );
|
void queueOutPacketForRange( Entity::Player& sourcePlayer, uint32_t range, Network::Packets::FFXIVPacketBasePtr pPacketEntry );
|
||||||
|
|
||||||
uint32_t getGuId() const;
|
uint32_t getGuId() const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue