mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-05 10:17:46 +00:00
Merge pull request #334 from NotAdam/develop
use structs for incoming packets & some cleanup
This commit is contained in:
commit
7a0390d38e
18 changed files with 328 additions and 253 deletions
|
@ -27,6 +27,23 @@ namespace Common {
|
||||||
float z;
|
float z;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum InventoryOperation : uint8_t
|
||||||
|
{
|
||||||
|
Discard = 0x07,
|
||||||
|
Move = 0x08,
|
||||||
|
Swap = 0x09,
|
||||||
|
Merge = 0x0C,
|
||||||
|
Split = 0x0A
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ClientLanguage : uint8_t
|
||||||
|
{
|
||||||
|
Japanese = 1,
|
||||||
|
English = 2,
|
||||||
|
German = 4,
|
||||||
|
French = 8
|
||||||
|
};
|
||||||
|
|
||||||
enum EquipSlot : uint8_t
|
enum EquipSlot : uint8_t
|
||||||
{
|
{
|
||||||
MainHand = 0,
|
MainHand = 0,
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
#include "XMLConfig.h"
|
|
||||||
#include <boost/property_tree/json_parser.hpp>
|
|
||||||
#include <boost/property_tree/xml_parser.hpp>
|
|
||||||
#include <boost/property_tree/ptree.hpp>
|
|
||||||
#include <boost/foreach.hpp>
|
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
|
||||||
#include <boost/lexical_cast.hpp>
|
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
// instanciate and load a config
|
|
||||||
XMLConfig::XMLConfig()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
XMLConfig::~XMLConfig()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
using boost::property_tree::ptree;
|
|
||||||
const ptree& empty_ptree()
|
|
||||||
{
|
|
||||||
static ptree t;
|
|
||||||
return t;
|
|
||||||
};
|
|
||||||
|
|
||||||
bool XMLConfig::loadConfig( const std::string& fileName )
|
|
||||||
{
|
|
||||||
|
|
||||||
boost::property_tree::read_xml( fileName, m_propTree );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,73 +0,0 @@
|
||||||
#ifndef __XMLCONFIG_H
|
|
||||||
#define __XMLCONFIG_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <boost/property_tree/ptree.hpp>
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
|
|
||||||
// very simple XML parser class
|
|
||||||
// this hasn't gotten much attention yet as it works good as it is.
|
|
||||||
class XMLConfig
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef std::map<std::string, std::string> SettingMap;
|
|
||||||
typedef std::map<std::string, SettingMap> CategoryMap;
|
|
||||||
|
|
||||||
// instanciate and load a config
|
|
||||||
XMLConfig();
|
|
||||||
|
|
||||||
~XMLConfig();
|
|
||||||
|
|
||||||
// load a config file
|
|
||||||
bool loadConfig( const std::string& fileName );
|
|
||||||
|
|
||||||
template< class T >
|
|
||||||
T getValue( const std::string& name, T defaultValue = T() )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return m_propTree.get< T >( name );
|
|
||||||
}
|
|
||||||
catch( ... )
|
|
||||||
{
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template< class T >
|
|
||||||
void setValue( const std::string& name, T defaultValue = T() )
|
|
||||||
{
|
|
||||||
m_propTree.put( name, defaultValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
template< class T >
|
|
||||||
T getAttrValue( boost::property_tree::ptree node, const std::string& name, T defaultValue = T() )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
T outVal = node.get< T >( "<xmlattr>." + name );
|
|
||||||
return outVal;
|
|
||||||
}
|
|
||||||
catch( const std::runtime_error& )
|
|
||||||
{
|
|
||||||
T outVal = defaultValue;
|
|
||||||
return outVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boost::property_tree::ptree getChild( const std::string& name )
|
|
||||||
{
|
|
||||||
auto val = m_propTree.get_child( name );
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
boost::property_tree::ptree m_propTree;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -219,7 +219,7 @@ namespace Core {
|
||||||
|
|
||||||
enum ClientTriggerType
|
enum ClientTriggerType
|
||||||
{
|
{
|
||||||
ToggleSeathe = 0x01,
|
ToggleSheathe = 0x01,
|
||||||
ToggleAutoAttack = 0x02,
|
ToggleAutoAttack = 0x02,
|
||||||
ChangeTarget = 0x03,
|
ChangeTarget = 0x03,
|
||||||
|
|
||||||
|
|
|
@ -137,10 +137,11 @@ struct FFXIVARR_PACKET_RAW
|
||||||
*/
|
*/
|
||||||
enum FFXIVARR_SEGMENT_TYPE
|
enum FFXIVARR_SEGMENT_TYPE
|
||||||
{
|
{
|
||||||
|
SEGMENTTYPE_SESSIONINIT = 1,
|
||||||
SEGMENTTYPE_IPC = 3,
|
SEGMENTTYPE_IPC = 3,
|
||||||
SEGMENTTYPE_RESPONSE = 7,
|
SEGMENTTYPE_KEEPALIVE = 7,
|
||||||
SEGMENTTYPE_KEEPALIVE = 8,
|
//SEGMENTTYPE_RESPONSE = 8,
|
||||||
SEGMENTTYPE_ENCRYPTIONHANDSHAKE = 9,
|
SEGMENTTYPE_ENCRYPTIONINIT = 9,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -179,6 +179,18 @@ public:
|
||||||
initialize();
|
initialize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FFXIVIpcPacket< T, T1 >( const FFXIVARR_PACKET_RAW& rawPacket )
|
||||||
|
{
|
||||||
|
auto ipcHdrSize = sizeof( FFXIVARR_IPC_HEADER );
|
||||||
|
auto copySize = std::min< uint32_t >( sizeof( T ), rawPacket.segHdr.size - ipcHdrSize );
|
||||||
|
|
||||||
|
memcpy( &m_segHdr, &rawPacket.segHdr, sizeof( FFXIVARR_PACKET_SEGMENT_HEADER ) );
|
||||||
|
memcpy( &m_data, &rawPacket.data[0] + ipcHdrSize, copySize );
|
||||||
|
|
||||||
|
memset( &m_ipcHdr, 0, ipcHdrSize );
|
||||||
|
m_ipcHdr.type = static_cast< ServerZoneIpcType >( m_data._ServerIpcType );
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t getContentSize() override
|
uint32_t getContentSize() override
|
||||||
{
|
{
|
||||||
return sizeof( FFXIVARR_IPC_HEADER ) + sizeof( T );
|
return sizeof( FFXIVARR_IPC_HEADER ) + sizeof( T );
|
||||||
|
@ -215,6 +227,8 @@ public:
|
||||||
/** Gets a reference to the underlying IPC data structure. */
|
/** Gets a reference to the underlying IPC data structure. */
|
||||||
T& data() { return m_data; };
|
T& data() { return m_data; };
|
||||||
|
|
||||||
|
const T& data() const { return m_data; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Initializes the fields of the header structures */
|
/** Initializes the fields of the header structures */
|
||||||
virtual void initialize()
|
virtual void initialize()
|
||||||
|
|
|
@ -91,8 +91,9 @@ namespace Packets {
|
||||||
LogMessage = 0x00D0,
|
LogMessage = 0x00D0,
|
||||||
|
|
||||||
LinkshellList = 0x011C, // updated 4.3
|
LinkshellList = 0x011C, // updated 4.3
|
||||||
SetCharaFCTag = 0x013B, // updated 4.3
|
CharaFreeCompanyTag = 0x013B, // updated 4.3
|
||||||
SetFreeCompanyInfo = 0x013D, // updated 4.3
|
FreeCompanyBoardMsg = 0x013C, // updated 4.3
|
||||||
|
FreeCompanyInfo = 0x013D, // updated 4.3
|
||||||
|
|
||||||
StatusEffectList = 0x014E, // updated 4.3
|
StatusEffectList = 0x014E, // updated 4.3
|
||||||
Effect = 0x0151, // updated 4.3
|
Effect = 0x0151, // updated 4.3
|
||||||
|
@ -223,13 +224,17 @@ namespace Packets {
|
||||||
|
|
||||||
|
|
||||||
ReqJoinNoviceNetwork = 0x0129, // updated 4.2
|
ReqJoinNoviceNetwork = 0x0129, // updated 4.2
|
||||||
ReqCountdownInitiate = 0x012C, // updated 4.2
|
|
||||||
ReqCountdownCancel = 0x012D, // updated 4.2
|
ReqCountdownInitiate = 0x0138, // updated 4.3
|
||||||
|
ReqCountdownCancel = 0x0139, // updated 4.3
|
||||||
|
ClearWaymarks = 0x013A, // updated 4.3
|
||||||
|
|
||||||
ZoneLineHandler = 0x013C, // updated 4.3
|
ZoneLineHandler = 0x013C, // updated 4.3
|
||||||
ClientTrigger = 0x013D, // updated 4.3
|
ClientTrigger = 0x013D, // updated 4.3
|
||||||
DiscoveryHandler = 0x013E, // updated 4.3
|
DiscoveryHandler = 0x013E, // updated 4.3
|
||||||
|
|
||||||
|
AddWaymark = 0x013F, // updated 4.3
|
||||||
|
|
||||||
SkillHandler = 0x0140, // updated 4.3
|
SkillHandler = 0x0140, // updated 4.3
|
||||||
GMCommand1 = 0x0141, // updated 4.3
|
GMCommand1 = 0x0141, // updated 4.3
|
||||||
GMCommand2 = 0x0142, // updated 4.3
|
GMCommand2 = 0x0142, // updated 4.3
|
||||||
|
|
171
src/common/Network/PacketDef/Zone/ClientZoneDef.h
Normal file
171
src/common/Network/PacketDef/Zone/ClientZoneDef.h
Normal file
|
@ -0,0 +1,171 @@
|
||||||
|
#ifndef _CORE_NETWORK_PACKETS_ZONE_CLIENT_IPC_H
|
||||||
|
#define _CORE_NETWORK_PACKETS_ZONE_CLIENT_IPC_H
|
||||||
|
|
||||||
|
#include <Common.h>
|
||||||
|
#include <Network/CommonNetwork.h>
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
namespace Network {
|
||||||
|
namespace Packets {
|
||||||
|
namespace Client {
|
||||||
|
|
||||||
|
struct FFXIVIpcGmCommand1 : FFXIVIpcBasePacket< GMCommand1 >
|
||||||
|
{
|
||||||
|
/* 0000 */ uint32_t commandId;
|
||||||
|
/* 0004 */ uint32_t param1;
|
||||||
|
/* 0008 */ uint32_t param2;
|
||||||
|
/* 000C */ uint8_t unknown_C[0xC];
|
||||||
|
/* 0018 */ uint32_t param3;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcGmCommand2 : FFXIVIpcBasePacket< GMCommand2 >
|
||||||
|
{
|
||||||
|
/* 0000 */ uint32_t commandId;
|
||||||
|
/* 0004 */ char unk_4[0x10];
|
||||||
|
/* 0014 */ char param1[0x20];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcClientTrigger : FFXIVIpcBasePacket< ClientTrigger >
|
||||||
|
{
|
||||||
|
/* 0000 */ uint16_t commandId;
|
||||||
|
/* 0002 */ uint8_t unk_2[2];
|
||||||
|
/* 0004 */ uint32_t param11;
|
||||||
|
/* 0008 */ uint32_t param12;
|
||||||
|
/* 000C */ uint32_t param2;
|
||||||
|
/* 0010 */ char unk_10[8];
|
||||||
|
/* 0018 */ uint64_t param3;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcSkillHandler : FFXIVIpcBasePacket< SkillHandler >
|
||||||
|
{
|
||||||
|
/* 0000 */ char pad_0000[1];
|
||||||
|
/* 0001 */ uint8_t type;
|
||||||
|
/* 0002 */ char pad_0002[2];
|
||||||
|
/* 0004 */ uint32_t actionId;
|
||||||
|
/* 0008 */ uint32_t useCount;
|
||||||
|
/* 000C */ char pad_000C[4];
|
||||||
|
/* 0010 */ uint64_t targetId;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcZoneLineHandler : FFXIVIpcBasePacket< ZoneLineHandler >
|
||||||
|
{
|
||||||
|
/* 0000 */ uint32_t zoneLineId;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcDiscoveryHandler : FFXIVIpcBasePacket< DiscoveryHandler >
|
||||||
|
{
|
||||||
|
/* 0000 */ uint32_t positionRef;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcEventHandlerReturn : FFXIVIpcBasePacket< ReturnEventHandler >
|
||||||
|
{
|
||||||
|
/* 0000 */ uint32_t eventId;
|
||||||
|
/* 0004 */ uint16_t scene;
|
||||||
|
/* 0006 */ uint16_t param1;
|
||||||
|
/* 0008 */ uint16_t param2;
|
||||||
|
/* 000A */ char pad_000A[2];
|
||||||
|
/* 000C */ uint16_t param3;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcEnterTerritoryHandler : FFXIVIpcBasePacket< EnterTeriEventHandler >
|
||||||
|
{
|
||||||
|
/* 0000 */ uint32_t eventId;
|
||||||
|
/* 0004 */ uint16_t param1;
|
||||||
|
/* 0006 */ uint16_t param2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcEventHandlerOutsideRange : FFXIVIpcBasePacket< OutOfRangeEventHandler >
|
||||||
|
{
|
||||||
|
/* 0000 */ uint32_t param1;
|
||||||
|
/* 0004 */ uint32_t eventId;
|
||||||
|
/* 0008 */ Common::FFXIVARR_POSITION3 position;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcEventHandlerWithinRange : FFXIVIpcBasePacket< WithinRangeEventHandler >
|
||||||
|
{
|
||||||
|
/* 0000 */ uint32_t param1;
|
||||||
|
/* 0004 */ uint32_t eventId;
|
||||||
|
/* 0008 */ Common::FFXIVARR_POSITION3 position;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcEventHandlerEmote : FFXIVIpcBasePacket< EmoteEventHandler >
|
||||||
|
{
|
||||||
|
/* 0000 */ uint64_t actorId;
|
||||||
|
/* 0008 */ uint32_t eventId;
|
||||||
|
/* 000C */ uint16_t emoteId;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcEventHandlerTalk : FFXIVIpcBasePacket< TalkEventHandler >
|
||||||
|
{
|
||||||
|
/* 0000 */ uint64_t actorId;
|
||||||
|
/* 0008 */ uint32_t eventId;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcPingHandler : FFXIVIpcBasePacket< PingHandler >
|
||||||
|
{
|
||||||
|
/* 0000 */ uint32_t timestamp; // maybe lol..
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcSetSearchInfo : FFXIVIpcBasePacket< SetSearchInfoHandler >
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
/* 0000 */ uint64_t status;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
/* 0000 */ uint32_t status1;
|
||||||
|
/* 0004 */ uint32_t status2;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 0008 */ char pad_0008[9];
|
||||||
|
/* 0011 */ Common::ClientLanguage language;
|
||||||
|
/* 0012 */ char searchComment[193];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcTellHandler : FFXIVIpcBasePacket< TellReq >
|
||||||
|
{
|
||||||
|
/* 0000 */ char pad_0000[4];
|
||||||
|
/* 0004 */ char targetPCName[32];
|
||||||
|
/* 0024 */ char message[1012];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcChatHandler : FFXIVIpcBasePacket< ChatHandler >
|
||||||
|
{
|
||||||
|
/* 0000 */ char pad_0000[4];
|
||||||
|
/* 0004 */ uint32_t sourceId;
|
||||||
|
/* 0008 */ char pad_0008[16];
|
||||||
|
/* 0018 */ Common::ChatType chatType;
|
||||||
|
/* 001A */ char message[1012];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcLinkshellEventHandler : FFXIVIpcBasePacket< LinkshellEventHandler >
|
||||||
|
{
|
||||||
|
/* 0000 */ uint32_t eventId;
|
||||||
|
/* 0004 */ uint16_t scene;
|
||||||
|
/* 0006 */ char pad_0006[1];
|
||||||
|
/* 0007 */ char lsName[21];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FFXIVIpcInventoryModifyHandler : FFXIVIpcBasePacket< InventoryModifyHandler >
|
||||||
|
{
|
||||||
|
/* 0000 */ uint32_t seq;
|
||||||
|
/* 0004 */ Common::InventoryOperation action;
|
||||||
|
/* 0005 */ char pad_0005[3];
|
||||||
|
/* 0008 */ uint16_t splitCount; // todo: check packet handler in game and see if this is sent as a u16 or u32
|
||||||
|
/* 000A */ char pad_000A[2];
|
||||||
|
/* 000C */ uint16_t fromContainer;
|
||||||
|
/* 000E */ char pad_000E[2];
|
||||||
|
/* 0010 */ uint8_t fromSlot;
|
||||||
|
/* 0011 */ char pad_0011[15];
|
||||||
|
/* 0020 */ uint16_t toContainer;
|
||||||
|
/* 0022 */ char pad_0022[2];
|
||||||
|
/* 0024 */ uint8_t toSlot;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //_CORE_NETWORK_PACKETS_ZONE_CLIENT_IPC_H
|
|
@ -482,7 +482,7 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
|
||||||
|
|
||||||
switch( inPacket.segHdr.type )
|
switch( inPacket.segHdr.type )
|
||||||
{
|
{
|
||||||
case 9: // Encryption init
|
case SEGMENTTYPE_ENCRYPTIONINIT: // Encryption init
|
||||||
{
|
{
|
||||||
std::string key_phrase( reinterpret_cast< char* >( &inPacket.data[36] ) );
|
std::string key_phrase( reinterpret_cast< char* >( &inPacket.data[36] ) );
|
||||||
generateEncryptionKey( *reinterpret_cast< uint32_t* >( &inPacket.data[100] ), key_phrase );
|
generateEncryptionKey( *reinterpret_cast< uint32_t* >( &inPacket.data[100] ), key_phrase );
|
||||||
|
@ -500,13 +500,13 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
case 3: // game packet
|
case SEGMENTTYPE_IPC: // game packet
|
||||||
{
|
{
|
||||||
g_log.info( "GamePacket [" + std::to_string( inPacket.segHdr.type ) + "]" );
|
g_log.info( "GamePacket [" + std::to_string( inPacket.segHdr.type ) + "]" );
|
||||||
handleGamePacket( inPacket );
|
handleGamePacket( inPacket );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 7: // keep alive
|
case SEGMENTTYPE_KEEPALIVE: // keep alive
|
||||||
{
|
{
|
||||||
uint32_t id = *reinterpret_cast< uint32_t* >( &inPacket.data[0] );
|
uint32_t id = *reinterpret_cast< uint32_t* >( &inPacket.data[0] );
|
||||||
uint32_t timeStamp = *reinterpret_cast< uint32_t* >( &inPacket.data[4] );
|
uint32_t timeStamp = *reinterpret_cast< uint32_t* >( &inPacket.data[4] );
|
||||||
|
|
|
@ -488,7 +488,7 @@ void Core::Entity::Player::updateDbSearchInfo() const
|
||||||
stmtS1->setInt( 2, m_id );
|
stmtS1->setInt( 2, m_id );
|
||||||
pDb->execute( stmtS1 );
|
pDb->execute( stmtS1 );
|
||||||
|
|
||||||
auto stmtS2 = pDb->getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SELECTREGION );
|
auto stmtS2 = pDb->getPreparedStatement( Db::CHARA_SEARCHINFO_UP_SEARCHCOMMENT );
|
||||||
stmtS2->setString( 1, string( m_searchMessage != nullptr ? m_searchMessage : "" ) );
|
stmtS2->setString( 1, string( m_searchMessage != nullptr ? m_searchMessage : "" ) );
|
||||||
stmtS2->setInt( 2, m_id );
|
stmtS2->setInt( 2, m_id );
|
||||||
pDb->execute( stmtS2 );
|
pDb->execute( stmtS2 );
|
||||||
|
|
|
@ -211,7 +211,7 @@ void Core::Network::GameConnection::handleZonePacket( Core::Network::Packets::FF
|
||||||
pLog->debug( sessionStr + " Undefined Zone IPC : Unknown ( " +
|
pLog->debug( sessionStr + " Undefined Zone IPC : Unknown ( " +
|
||||||
boost::str( boost::format( "%|04X|" ) %
|
boost::str( boost::format( "%|04X|" ) %
|
||||||
static_cast< uint32_t >( opcode ) ) + " )" );
|
static_cast< uint32_t >( opcode ) ) + " )" );
|
||||||
//pLog->debug( "\n" + pPacket.toString() );
|
pLog->debug( "Dump:\n" + Util::binaryToHexDump( const_cast< uint8_t* >( &pPacket.data[0] ), pPacket.segHdr.size ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
|
||||||
{
|
{
|
||||||
switch( inPacket.segHdr.type )
|
switch( inPacket.segHdr.type )
|
||||||
{
|
{
|
||||||
case 1:
|
case SEGMENTTYPE_SESSIONINIT:
|
||||||
{
|
{
|
||||||
char* id = ( char* ) &( inPacket.data[4] );
|
char* id = ( char* ) &( inPacket.data[4] );
|
||||||
uint32_t playerId = boost::lexical_cast< uint32_t >( id );
|
uint32_t playerId = boost::lexical_cast< uint32_t >( id );
|
||||||
|
@ -445,12 +445,12 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
case 3: // game packet
|
case SEGMENTTYPE_IPC: // game packet
|
||||||
{
|
{
|
||||||
queueInPacket( inPacket );
|
queueInPacket( inPacket );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 7: // keep alive
|
case SEGMENTTYPE_KEEPALIVE: // keep alive
|
||||||
{
|
{
|
||||||
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];
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <Exd/ExdDataGenerated.h>
|
#include <Exd/ExdDataGenerated.h>
|
||||||
#include <Network/PacketContainer.h>
|
#include <Network/PacketContainer.h>
|
||||||
#include <Network/CommonActorControl.h>
|
#include <Network/CommonActorControl.h>
|
||||||
|
#include <Network/PacketDef/Zone/ClientZoneDef.h>
|
||||||
|
|
||||||
#include "Zone/Zone.h"
|
#include "Zone/Zone.h"
|
||||||
#include "Zone/ZonePosition.h"
|
#include "Zone/ZonePosition.h"
|
||||||
|
@ -42,15 +43,16 @@ using namespace Core::Network::ActorControl;
|
||||||
void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
|
||||||
|
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = g_fw.get< Logger >();
|
||||||
uint16_t commandId = *reinterpret_cast< uint16_t* >( ©.data[0x10] );
|
|
||||||
uint64_t param1 = *reinterpret_cast< uint64_t* >( ©.data[0x14] );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcClientTrigger >( inPacket );
|
||||||
uint32_t param11 = *reinterpret_cast< uint32_t* >( ©.data[0x14] );
|
|
||||||
uint32_t param12 = *reinterpret_cast< uint32_t* >( ©.data[0x18] );
|
const auto& commandId = packet.data().commandId;
|
||||||
uint32_t param2 = *reinterpret_cast< uint32_t* >( ©.data[0x1C] );
|
const auto& param1 = *reinterpret_cast< const uint64_t* >( &packet.data().param11 );
|
||||||
uint64_t param3 = *reinterpret_cast< uint64_t* >( ©.data[0x28] );
|
const auto& param11 = packet.data().param11;
|
||||||
|
const auto& param12 = packet.data().param12;
|
||||||
|
const auto& param2 = packet.data().param2;
|
||||||
|
const auto& param3 = packet.data().param3;
|
||||||
|
|
||||||
pLog->debug( "[" + std::to_string( m_pSession->getId() ) + "] Incoming action: " +
|
pLog->debug( "[" + std::to_string( m_pSession->getId() ) + "] Incoming action: " +
|
||||||
boost::str( boost::format( "%|04X|" ) % ( uint32_t ) ( commandId & 0xFFFF ) ) +
|
boost::str( boost::format( "%|04X|" ) % ( uint32_t ) ( commandId & 0xFFFF ) ) +
|
||||||
|
@ -64,7 +66,7 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
|
||||||
|
|
||||||
switch( commandId )
|
switch( commandId )
|
||||||
{
|
{
|
||||||
case ClientTriggerType::ToggleSeathe: // Toggle sheathe
|
case ClientTriggerType::ToggleSheathe: // Toggle sheathe
|
||||||
{
|
{
|
||||||
if ( param11 == 1 )
|
if ( param11 == 1 )
|
||||||
player.setStance( Entity::Chara::Stance::Active );
|
player.setStance( Entity::Chara::Stance::Active );
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <Network/PacketContainer.h>
|
#include <Network/PacketContainer.h>
|
||||||
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
#include <Network/PacketDef/Zone/ServerZoneDef.h>
|
||||||
#include <sapphire_zone/Event/EventHandler.h>
|
#include <sapphire_zone/Event/EventHandler.h>
|
||||||
|
#include <Network/PacketDef/Zone/ClientZoneDef.h>
|
||||||
|
|
||||||
#include "Network/GameConnection.h"
|
#include "Network/GameConnection.h"
|
||||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||||
|
@ -38,10 +39,12 @@ void Core::Network::GameConnection::eventHandlerTalk( const Packets::FFXIVARR_PA
|
||||||
{
|
{
|
||||||
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
|
||||||
|
|
||||||
auto actorId = *reinterpret_cast< uint64_t* >( ©.data[0x10] );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcEventHandlerTalk >( inPacket );
|
||||||
auto eventId = *reinterpret_cast< uint32_t* >( ©.data[0x18] );
|
|
||||||
|
const auto& actorId = packet.data().actorId;
|
||||||
|
const auto& eventId = packet.data().eventId;
|
||||||
|
|
||||||
auto eventType = static_cast< uint16_t >( eventId >> 16 );
|
auto eventType = static_cast< uint16_t >( eventId >> 16 );
|
||||||
|
|
||||||
std::string eventName = "onTalk";
|
std::string eventName = "onTalk";
|
||||||
|
@ -81,12 +84,13 @@ void Core::Network::GameConnection::eventHandlerEmote( const Packets::FFXIVARR_P
|
||||||
|
|
||||||
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
||||||
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
|
||||||
|
|
||||||
auto actorId = *reinterpret_cast< uint64_t* >( ©.data[0x10] );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcEventHandlerEmote >( inPacket );
|
||||||
auto eventId = *reinterpret_cast< uint32_t* >( ©.data[0x18] );
|
|
||||||
auto emoteId = *reinterpret_cast< uint16_t* >( ©.data[0x1C] );
|
const auto& actorId = packet.data().actorId;
|
||||||
auto eventType = static_cast< uint16_t >( eventId >> 16 );
|
const auto& eventId = packet.data().eventId;
|
||||||
|
const auto& emoteId = packet.data().emoteId;
|
||||||
|
const auto eventType = static_cast< uint16_t >( eventId >> 16 );
|
||||||
|
|
||||||
std::string eventName = "onEmote";
|
std::string eventName = "onEmote";
|
||||||
std::string objName = Event::getEventName( eventId );
|
std::string objName = Event::getEventName( eventId );
|
||||||
|
@ -118,14 +122,12 @@ void Core::Network::GameConnection::eventHandlerWithinRange( const Packets::FFXI
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
|
||||||
|
|
||||||
auto eventId = *reinterpret_cast< uint32_t* >( ©.data[0x14] );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcEventHandlerWithinRange >( inPacket );
|
||||||
auto param1 = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
|
||||||
|
|
||||||
auto x = *reinterpret_cast< float* >( ©.data[0x18] );
|
const auto& eventId = packet.data().eventId;
|
||||||
auto y = *reinterpret_cast< float* >( ©.data[0x1C] );
|
const auto& param1 = packet.data().param1;
|
||||||
auto z = *reinterpret_cast< float* >( ©.data[0x20] );
|
const auto& pos = packet.data().position;
|
||||||
|
|
||||||
std::string eventName = "onWithinRange";
|
std::string eventName = "onWithinRange";
|
||||||
std::string objName = Event::getEventName( eventId );
|
std::string objName = Event::getEventName( eventId );
|
||||||
|
@ -134,7 +136,7 @@ void Core::Network::GameConnection::eventHandlerWithinRange( const Packets::FFXI
|
||||||
|
|
||||||
player.eventStart( player.getId(), eventId, Event::EventHandler::WithinRange, 1, param1 );
|
player.eventStart( player.getId(), eventId, Event::EventHandler::WithinRange, 1, param1 );
|
||||||
|
|
||||||
pScriptMgr->onWithinRange( player, eventId, param1, x, y, z );
|
pScriptMgr->onWithinRange( player, eventId, param1, pos.x, pos.y, pos.z );
|
||||||
|
|
||||||
player.checkEvent( eventId );
|
player.checkEvent( eventId );
|
||||||
}
|
}
|
||||||
|
@ -143,14 +145,11 @@ void Core::Network::GameConnection::eventHandlerOutsideRange( const Packets::FFX
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
|
||||||
|
|
||||||
auto eventId = *reinterpret_cast< uint32_t* >( ©.data[0x14] );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcEventHandlerOutsideRange >( inPacket );
|
||||||
auto param1 = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
const auto& eventId = packet.data().eventId;
|
||||||
|
const auto& param1 = packet.data().param1;
|
||||||
auto x = *reinterpret_cast< float* >( ©.data[0x18] );
|
const auto& pos = packet.data().position;
|
||||||
auto y = *reinterpret_cast< float* >( ©.data[0x1C] );
|
|
||||||
auto z = *reinterpret_cast< float* >( ©.data[0x20] );
|
|
||||||
|
|
||||||
std::string eventName = "onOutsideRange";
|
std::string eventName = "onOutsideRange";
|
||||||
std::string objName = Event::getEventName( eventId );
|
std::string objName = Event::getEventName( eventId );
|
||||||
|
@ -159,7 +158,7 @@ void Core::Network::GameConnection::eventHandlerOutsideRange( const Packets::FFX
|
||||||
|
|
||||||
player.eventStart( player.getId(), eventId, Event::EventHandler::WithinRange, 1, param1 );
|
player.eventStart( player.getId(), eventId, Event::EventHandler::WithinRange, 1, param1 );
|
||||||
|
|
||||||
pScriptMgr->onOutsideRange( player, eventId, param1, x, y, z );
|
pScriptMgr->onOutsideRange( player, eventId, param1, pos.x, pos.y, pos.z );
|
||||||
|
|
||||||
player.checkEvent( eventId );
|
player.checkEvent( eventId );
|
||||||
}
|
}
|
||||||
|
@ -168,11 +167,12 @@ void Core::Network::GameConnection::eventHandlerEnterTerritory( const Packets::F
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
|
||||||
|
|
||||||
auto eventId = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcEnterTerritoryHandler >( inPacket );
|
||||||
auto param1 = *reinterpret_cast< uint16_t* >( ©.data[0x14] );
|
|
||||||
auto param2 = *reinterpret_cast< uint16_t* >( ©.data[0x16] );
|
const auto& eventId = packet.data().eventId;
|
||||||
|
const auto& param1 = packet.data().param1;
|
||||||
|
const auto& param2 = packet.data().param2;
|
||||||
|
|
||||||
std::string eventName = "onEnterTerritory";
|
std::string eventName = "onEnterTerritory";
|
||||||
|
|
||||||
|
@ -197,13 +197,12 @@ void Core::Network::GameConnection::eventHandlerEnterTerritory( const Packets::F
|
||||||
void Core::Network::GameConnection::eventHandlerReturn( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::eventHandlerReturn( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcEventHandlerReturn >( inPacket );
|
||||||
|
const auto& eventId = packet.data().eventId;
|
||||||
auto eventId = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
const auto& scene = packet.data().scene;
|
||||||
auto scene = *reinterpret_cast< uint16_t* >( ©.data[0x14] );
|
const auto& param1 = packet.data().param1;
|
||||||
auto param1 = *reinterpret_cast< uint16_t* >( ©.data[0x16] );
|
const auto& param2 = packet.data().param2;
|
||||||
auto param2 = *reinterpret_cast< uint16_t* >( ©.data[0x18] );
|
const auto& param3 = packet.data().param3;
|
||||||
auto param3 = *reinterpret_cast< uint16_t* >( ©.data[0x1C] );
|
|
||||||
|
|
||||||
std::string eventName = Event::getEventName( eventId );
|
std::string eventName = Event::getEventName( eventId );
|
||||||
|
|
||||||
|
@ -244,15 +243,11 @@ void Core::Network::GameConnection::eventHandlerReturn( const Packets::FFXIVARR_
|
||||||
void Core::Network::GameConnection::eventHandlerLinkshell( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::eventHandlerLinkshell( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcLinkshellEventHandler >( inPacket );
|
||||||
|
|
||||||
auto eventId = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
auto linkshellEvent = makeZonePacket< Server::FFXIVIpcEventLinkshell >( player.getId() );
|
||||||
auto scene = *reinterpret_cast< uint16_t* >( ©.data[0x14] );
|
linkshellEvent->data().eventId = packet.data().eventId;
|
||||||
auto lsName = std::string( reinterpret_cast< char* >( ©.data[0x17] ) );
|
linkshellEvent->data().scene = static_cast< uint8_t >( packet.data().scene );
|
||||||
|
|
||||||
auto linkshellEvent = makeZonePacket< FFXIVIpcEventLinkshell >( player.getId() );
|
|
||||||
linkshellEvent->data().eventId = eventId;
|
|
||||||
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 );
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
#include <Network/PacketContainer.h>
|
#include <Network/PacketContainer.h>
|
||||||
#include <Network/CommonActorControl.h>
|
#include <Network/CommonActorControl.h>
|
||||||
|
#include <Network/PacketDef/Zone/ClientZoneDef.h>
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
|
@ -91,12 +92,11 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R
|
||||||
if( player.getGmRank() <= 0 )
|
if( player.getGmRank() <= 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcGmCommand1 >( inPacket );
|
||||||
auto commandId = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
const auto& commandId = packet.data().commandId;
|
||||||
|
const auto& param1 = packet.data().param1;
|
||||||
uint32_t param1 = *reinterpret_cast< uint32_t* >( ©.data[0x14] );
|
const auto& param2 = packet.data().param2;
|
||||||
uint32_t param2 = *reinterpret_cast< uint32_t* >( ©.data[0x18] );
|
const auto& param3 = packet.data().param3;
|
||||||
uint32_t param3 = *reinterpret_cast< uint32_t* >( ©.data[0x28] );
|
|
||||||
|
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = g_fw.get< Logger >();
|
||||||
pLog->debug( player.getName() + " used GM1 commandId: " + std::to_string( commandId ) +
|
pLog->debug( player.getName() + " used GM1 commandId: " + std::to_string( commandId ) +
|
||||||
|
@ -310,9 +310,11 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R
|
||||||
}
|
}
|
||||||
case GmCommand::Item:
|
case GmCommand::Item:
|
||||||
{
|
{
|
||||||
if( param2 < 1 || param2 > 99 )
|
auto quantity = param2;
|
||||||
|
|
||||||
|
if( quantity < 1 || quantity > 999 )
|
||||||
{
|
{
|
||||||
param2 = 1;
|
quantity = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( param1 == 0xcccccccc ) )
|
if( ( param1 == 0xcccccccc ) )
|
||||||
|
@ -321,7 +323,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !targetPlayer->addItem( -1, param1, param2 ) )
|
if( !targetPlayer->addItem( -1, param1, quantity ) )
|
||||||
player.sendUrgent( "Item " + std::to_string( param1 ) + " not found..." );
|
player.sendUrgent( "Item " + std::to_string( param1 ) + " not found..." );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -489,10 +491,10 @@ void Core::Network::GameConnection::gm2Handler( const Packets::FFXIVARR_PACKET_R
|
||||||
auto pLog = g_fw.get< Logger >();
|
auto pLog = g_fw.get< Logger >();
|
||||||
auto pServerZone = g_fw.get< ServerZone >();
|
auto pServerZone = g_fw.get< ServerZone >();
|
||||||
|
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcGmCommand2 >( inPacket );
|
||||||
auto commandId = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
|
||||||
|
|
||||||
auto param1 = std::string( reinterpret_cast< char* >( ©.data[0x24] ) );
|
const auto& commandId = packet.data().commandId;
|
||||||
|
const auto& param1 = std::string( packet.data().param1 );
|
||||||
|
|
||||||
pLog->debug( player.getName() + " used GM2 commandId: " + std::to_string( commandId ) + ", params: " + param1 );
|
pLog->debug( player.getName() + " used GM2 commandId: " + std::to_string( commandId ) + ", params: " + param1 );
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <Network/GamePacketNew.h>
|
#include <Network/GamePacketNew.h>
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
#include <Network/PacketContainer.h>
|
#include <Network/PacketContainer.h>
|
||||||
|
#include <Network/PacketDef/Zone/ClientZoneDef.h>
|
||||||
|
|
||||||
#include "Network/GameConnection.h"
|
#include "Network/GameConnection.h"
|
||||||
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
#include "Network/PacketWrappers/ServerNoticePacket.h"
|
||||||
|
@ -29,39 +30,26 @@ using namespace Core::Common;
|
||||||
using namespace Core::Network::Packets;
|
using namespace Core::Network::Packets;
|
||||||
using namespace Core::Network::Packets::Server;
|
using namespace Core::Network::Packets::Server;
|
||||||
|
|
||||||
enum InventoryOperation
|
|
||||||
{
|
|
||||||
Discard = 0x07,
|
|
||||||
Move = 0x08,
|
|
||||||
Swap = 0x09,
|
|
||||||
Merge = 0x0C,
|
|
||||||
Split = 0x0A
|
|
||||||
};
|
|
||||||
|
|
||||||
void Core::Network::GameConnection::inventoryModifyHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::inventoryModifyHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcInventoryModifyHandler >( inPacket );
|
||||||
auto seq = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
|
||||||
auto action = *reinterpret_cast< uint8_t* >( ©.data[0x14] );
|
|
||||||
auto fromSlot = *reinterpret_cast< uint8_t* >( ©.data[0x20] );
|
|
||||||
auto toSlot = *reinterpret_cast< uint8_t* >( ©.data[0x34] );
|
|
||||||
|
|
||||||
auto fromContainer = *reinterpret_cast< uint16_t* >( ©.data[0x1C] );
|
const auto& action = packet.data().action;
|
||||||
auto toContainer = *reinterpret_cast< uint16_t* >( ©.data[0x30] );
|
const auto& splitCount = packet.data().splitCount;
|
||||||
|
|
||||||
// todo: check packet handler in game and see if this is sent as a u16 or u32
|
const auto& fromSlot = packet.data().fromSlot;
|
||||||
auto splitCount = *reinterpret_cast< uint16_t* >( ©.data[0x38] );
|
const auto& fromContainer = packet.data().fromContainer;
|
||||||
|
const auto& toSlot = packet.data().toSlot;
|
||||||
|
const auto& toContainer = packet.data().toContainer;
|
||||||
|
|
||||||
auto ackPacket = makeZonePacket< FFXIVIpcInventoryActionAck >( player.getId() );
|
auto ackPacket = makeZonePacket< Server::FFXIVIpcInventoryActionAck >( player.getId() );
|
||||||
ackPacket->data().sequence = seq;
|
ackPacket->data().sequence = packet.data().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 >();
|
||||||
|
|
||||||
|
|
||||||
//pLog->debug( inPacket.toString() );
|
|
||||||
pLog->debug( "InventoryAction: " + std::to_string( action ) );
|
pLog->debug( "InventoryAction: " + std::to_string( action ) );
|
||||||
|
|
||||||
// TODO: other inventory operations need to be implemented
|
// TODO: other inventory operations need to be implemented
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <Util/Util.h>
|
#include <Util/Util.h>
|
||||||
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <Network/PacketDef/Zone/ClientZoneDef.h>
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
|
|
||||||
#include "Network/GameConnection.h"
|
#include "Network/GameConnection.h"
|
||||||
|
@ -63,15 +63,14 @@ void Core::Network::GameConnection::fcInfoReqHandler( const Core::Network::Packe
|
||||||
void Core::Network::GameConnection::setSearchInfoHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::setSearchInfoHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcSetSearchInfo >( inPacket );
|
||||||
|
|
||||||
auto inval = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
const auto& inval = packet.data().status1;
|
||||||
auto inval1 = *reinterpret_cast< uint32_t* >( ©.data[0x14] );
|
const auto& inval1 = packet.data().status2;
|
||||||
auto status = *reinterpret_cast< uint64_t* >( ©.data[0x10] );
|
const auto& status = packet.data().status;
|
||||||
|
const auto& selectRegion = packet.data().language;
|
||||||
|
|
||||||
auto selectRegion = copy.data[0x21];
|
player.setSearchInfo( selectRegion, 0, packet.data().searchComment );
|
||||||
|
|
||||||
player.setSearchInfo( selectRegion, 0, reinterpret_cast< char* >( ©.data[0x22] ) );
|
|
||||||
|
|
||||||
player.setOnlineStatusMask( status );
|
player.setOnlineStatusMask( status );
|
||||||
|
|
||||||
|
@ -261,8 +260,8 @@ void Core::Network::GameConnection::zoneLineHandler( const Core::Network::Packet
|
||||||
{
|
{
|
||||||
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
auto pTeriMgr = g_fw.get< TerritoryMgr >();
|
||||||
|
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcZoneLineHandler >( inPacket );
|
||||||
auto zoneLineId = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
const auto& zoneLineId = packet.data().zoneLineId;
|
||||||
|
|
||||||
player.sendDebug( "Walking ZoneLine " + std::to_string( zoneLineId ) );
|
player.sendDebug( "Walking ZoneLine " + std::to_string( zoneLineId ) );
|
||||||
|
|
||||||
|
@ -305,20 +304,18 @@ void Core::Network::GameConnection::zoneLineHandler( const Core::Network::Packet
|
||||||
void Core::Network::GameConnection::discoveryHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::discoveryHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcDiscoveryHandler >( inPacket );
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
const auto& positionRef = packet.data().positionRef;
|
||||||
|
|
||||||
auto ref_position_id = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
|
||||||
|
|
||||||
auto pDb = g_fw.get< Db::DbWorkerPool< Db::CharaDbConnection > >();
|
auto pDb = g_fw.get< Db::DbWorkerPool< Db::CharaDbConnection > >();
|
||||||
|
|
||||||
auto pQR = pDb->query( "SELECT id, map_id, discover_id "
|
auto pQR = pDb->query( "SELECT id, map_id, discover_id "
|
||||||
"FROM discoveryinfo "
|
"FROM discoveryinfo "
|
||||||
"WHERE id = " + std::to_string( ref_position_id ) + ";" );
|
"WHERE id = " + std::to_string( positionRef ) + ";" );
|
||||||
|
|
||||||
if( !pQR->next() )
|
if( !pQR->next() )
|
||||||
{
|
{
|
||||||
player.sendNotice( "Discovery ref pos ID: " + std::to_string( ref_position_id ) + " not found. " );
|
player.sendNotice( "Discovery ref pos ID: " + std::to_string( positionRef ) + " not found. " );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +324,7 @@ void Core::Network::GameConnection::discoveryHandler( const Core::Network::Packe
|
||||||
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( positionRef ) );
|
||||||
|
|
||||||
player.discover( pQR->getUInt16( 2 ), pQR->getUInt16( 3 ) );
|
player.discover( pQR->getUInt16( 2 ), pQR->getUInt16( 3 ) );
|
||||||
|
|
||||||
|
@ -371,10 +368,9 @@ void Core::Network::GameConnection::blackListHandler( const Core::Network::Packe
|
||||||
void Core::Network::GameConnection::pingHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::pingHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcPingHandler >( inPacket );
|
||||||
auto inVal = *reinterpret_cast< uint32_t* >( ©.data[0x10] );
|
|
||||||
|
|
||||||
queueOutPacket( boost::make_shared< PingPacket>( player, inVal ) );
|
queueOutPacket( boost::make_shared< Server::PingPacket >( player, packet.data().timestamp ) );
|
||||||
|
|
||||||
player.setLastPing( static_cast< uint32_t >( time( nullptr ) ) );
|
player.setLastPing( static_cast< uint32_t >( time( nullptr ) ) );
|
||||||
}
|
}
|
||||||
|
@ -465,23 +461,19 @@ void Core::Network::GameConnection::chatHandler( const Core::Network::Packets::F
|
||||||
{
|
{
|
||||||
auto pDebugCom = g_fw.get< DebugCommandHandler >();
|
auto pDebugCom = g_fw.get< DebugCommandHandler >();
|
||||||
|
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcChatHandler >( inPacket );
|
||||||
|
|
||||||
std::string chatString( reinterpret_cast< char* >( ©.data[0x2a] ) );
|
if( packet.data().message[0] == '!' )
|
||||||
|
|
||||||
auto sourceId = *reinterpret_cast< uint32_t* >( ©.data[0x14] );
|
|
||||||
|
|
||||||
if( chatString.at( 0 ) == '!' )
|
|
||||||
{
|
{
|
||||||
// execute game console command
|
// execute game console command
|
||||||
pDebugCom->execCommand( const_cast< char * >( chatString.c_str() ) + 1, player );
|
pDebugCom->execCommand( const_cast< char* >( packet.data().message ) + 1, player );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatType chatType = static_cast< ChatType >( inPacket.data[0x28] );
|
auto chatType = packet.data().chatType;
|
||||||
|
|
||||||
//ToDo, need to implement sending GM chat types.
|
//ToDo, need to implement sending GM chat types.
|
||||||
auto chatPacket = boost::make_shared< ChatPacket >( player, chatType, chatString );
|
auto chatPacket = boost::make_shared< Server::ChatPacket >( player, chatType, packet.data().message );
|
||||||
|
|
||||||
switch( chatType )
|
switch( chatType )
|
||||||
{
|
{
|
||||||
|
@ -537,19 +529,16 @@ void Core::Network::GameConnection::logoutHandler( const Core::Network::Packets:
|
||||||
void Core::Network::GameConnection::tellHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::tellHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcTellHandler >( inPacket );
|
||||||
|
|
||||||
std::string targetPcName( reinterpret_cast< char* >( ©.data[0x14] ) );
|
|
||||||
std::string msg( reinterpret_cast< char* >( ©.data[0x34] ) );
|
|
||||||
|
|
||||||
auto pZoneServer = g_fw.get< ServerZone >();
|
auto pZoneServer = g_fw.get< ServerZone >();
|
||||||
|
|
||||||
auto pSession = pZoneServer->getSession( targetPcName );
|
auto pSession = pZoneServer->getSession( packet.data().targetPCName );
|
||||||
|
|
||||||
if( !pSession )
|
if( !pSession )
|
||||||
{
|
{
|
||||||
auto tellErrPacket = makeZonePacket< FFXIVIpcTellErrNotFound >( player.getId() );
|
auto tellErrPacket = makeZonePacket< FFXIVIpcTellErrNotFound >( player.getId() );
|
||||||
strcpy( tellErrPacket->data().receipientName, targetPcName.c_str() );
|
strcpy( tellErrPacket->data().receipientName, packet.data().targetPCName );
|
||||||
sendSinglePacket( tellErrPacket );
|
sendSinglePacket( tellErrPacket );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -578,7 +567,7 @@ void Core::Network::GameConnection::tellHandler( const Core::Network::Packets::F
|
||||||
}
|
}
|
||||||
|
|
||||||
auto tellPacket = makeChatPacket< FFXIVIpcTell >( player.getId() );
|
auto tellPacket = makeChatPacket< FFXIVIpcTell >( player.getId() );
|
||||||
strcpy( tellPacket->data().msg, msg.c_str() );
|
strcpy( tellPacket->data().msg, packet.data().message );
|
||||||
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;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <Network/GamePacketNew.h>
|
#include <Network/GamePacketNew.h>
|
||||||
#include <Network/PacketContainer.h>
|
#include <Network/PacketContainer.h>
|
||||||
#include <Network/CommonActorControl.h>
|
#include <Network/CommonActorControl.h>
|
||||||
|
#include <Network/PacketDef/Zone/ClientZoneDef.h>
|
||||||
#include <Logging/Logger.h>
|
#include <Logging/Logger.h>
|
||||||
|
|
||||||
#include "Network/GameConnection.h"
|
#include "Network/GameConnection.h"
|
||||||
|
@ -38,14 +39,12 @@ using namespace Core::Network::ActorControl;
|
||||||
void Core::Network::GameConnection::skillHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
void Core::Network::GameConnection::skillHandler( const Packets::FFXIVARR_PACKET_RAW& inPacket,
|
||||||
Entity::Player& player )
|
Entity::Player& player )
|
||||||
{
|
{
|
||||||
Packets::FFXIVARR_PACKET_RAW copy = inPacket;
|
const auto packet = ZoneChannelPacket< Client::FFXIVIpcSkillHandler >( inPacket );
|
||||||
|
|
||||||
uint8_t type = inPacket.data[0x11];
|
const auto& type = packet.data().type;
|
||||||
|
const auto& action = packet.data().actionId;
|
||||||
auto action = *reinterpret_cast< uint32_t* >( ©.data[0x14] );
|
const auto& useCount = packet.data().useCount;
|
||||||
auto useCount = *reinterpret_cast< uint32_t* >( ©.data[0x18] );
|
const auto& targetId = packet.data().targetId;
|
||||||
|
|
||||||
auto targetId = *reinterpret_cast< uint64_t* >( ©.data[0x20] );
|
|
||||||
|
|
||||||
player.sendDebug( "Skill type:" + std::to_string( type ) );
|
player.sendDebug( "Skill type:" + std::to_string( type ) );
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ bool Core::Scripting::ScriptMgr::init()
|
||||||
scriptsLoaded++;
|
scriptsLoaded++;
|
||||||
}
|
}
|
||||||
|
|
||||||
pLog->info( "ScriptMgr: Loaded " + std::to_string( scriptsLoaded ) + "/" + std::to_string( scriptsFound ) + " scripts successfully" );
|
pLog->info( "ScriptMgr: Loaded " + std::to_string( scriptsLoaded ) + "/" + std::to_string( scriptsFound ) + " modules" );
|
||||||
|
|
||||||
watchDirectories();
|
watchDirectories();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue