1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-27 06:47:45 +00:00

added basic examine functionality

- todo: fix gear models not displaying
This commit is contained in:
Tahir Akhlaq 2018-09-10 14:34:24 +01:00
parent 78e8f98942
commit bffebd0bc7
7 changed files with 165 additions and 4 deletions

View file

@ -240,6 +240,7 @@ enum ClientTriggerType
FinishZoning = 0xC9, FinishZoning = 0xC9,
Teleport = 0xCA, Teleport = 0xCA,
Examine = 0x12C,
MarkPlayer = 0x12D, // Mark player, visible to party only MarkPlayer = 0x12D, // Mark player, visible to party only
SetTitleReq = 0x12E, SetTitleReq = 0x12E,
TitleList = 0x12F, TitleList = 0x12F,

View file

@ -76,16 +76,20 @@ enum ServerZoneIpcType :
SocialRequestResponse = 0x00BB, // updated 4.1 SocialRequestResponse = 0x00BB, // updated 4.1
CancelAllianceForming = 0x00C6, // updated 4.2 CancelAllianceForming = 0x00C6, // updated 4.2
Playtime = 0x00F5, // updated 4.3 Playtime = 0x00F5, // updated 4.3
Chat = 0x00F7, // updated 4.3 Chat = 0x00F7, // updated 4.3
SocialList = 0x00FD, // updated 4.3 SocialList = 0x00FD, // updated 4.3
UpdateSearchInfo = 0x0100, // updated 4.3 UpdateSearchInfo = 0x0100, // updated 4.3
InitSearchInfo = 0x0101, // updated 4.3 InitSearchInfo = 0x0101, // updated 4.3
ExamineSearchComment = 0x0102, // updated 4.1
ServerNotice = 0x0106, // updated 4.3 ServerNotice = 0x0106, // updated 4.3
SetOnlineStatus = 0x0107, // updated 4.3 SetOnlineStatus = 0x0107, // updated 4.3
CountdownInitiate = 0x0111, // updated 4.3 CountdownInitiate = 0x0111, // updated 4.3
CountdownCancel = 0x0112, // updated 4.3 CountdownCancel = 0x0112, // updated 4.3
@ -94,6 +98,8 @@ enum ServerZoneIpcType :
LogMessage = 0x00D0, LogMessage = 0x00D0,
LinkshellList = 0x011C, // updated 4.3 LinkshellList = 0x011C, // updated 4.3
ExamineFreeCompanyInfo = 0x013A, // updated 4.1
CharaFreeCompanyTag = 0x013B, // updated 4.3 CharaFreeCompanyTag = 0x013B, // updated 4.3
FreeCompanyBoardMsg = 0x013C, // updated 4.3 FreeCompanyBoardMsg = 0x013C, // updated 4.3
FreeCompanyInfo = 0x013D, // updated 4.3 FreeCompanyInfo = 0x013D, // updated 4.3
@ -130,7 +136,7 @@ enum ServerZoneIpcType :
PlayerStateFlags = 0x0184, // updated 4.3 PlayerStateFlags = 0x0184, // updated 4.3
PlayerClassInfo = 0x0185, // updated 4.3 PlayerClassInfo = 0x0185, // updated 4.3
ModelEquip = 0x0186, // updated 4.3 ModelEquip = 0x0186, // updated 4.3
Examine = 0x0187, // update 4.1
UpdateClassInfo = 0x018A, // updated 4.3 UpdateClassInfo = 0x018A, // updated 4.3
ItemInfo = 0x0190, // updated 4.3 ItemInfo = 0x0190, // updated 4.3
@ -190,7 +196,7 @@ enum ServerZoneIpcType :
// Unknown IPC types that still need to be sent // Unknown IPC types that still need to be sent
// TODO: figure all these out properly // TODO: figure all these out properly
IPCTYPE_UNK_320 = 0x024C, // updated 4.3 IPCTYPE_UNK_320 = 0x024C, // updated 4.3
IPCTYPE_UNK_322 = 0x024E, // updated 4.3 IPCTYPE_UNK_322 = 0x024E, // updated 4.3
}; };
@ -224,6 +230,8 @@ enum ClientZoneIpcType :
SocialListHandler = 0x00DB, // updated 4.3 SocialListHandler = 0x00DB, // updated 4.3
ReqSearchInfoHandler = 0x00E0, // updated 4.3 ReqSearchInfoHandler = 0x00E0, // updated 4.3
ReqExamineSearchCommentHandler = 0x00E1, // updated 4.1
SetSearchInfoHandler = 0x00DE, // updated 4.3 SetSearchInfoHandler = 0x00DE, // updated 4.3
BlackListHandler = 0x00EC, // updated 4.3 BlackListHandler = 0x00EC, // updated 4.3
@ -232,6 +240,7 @@ enum ClientZoneIpcType :
LinkshellListHandler = 0x00F4, // updated 4.3 LinkshellListHandler = 0x00F4, // updated 4.3
SearchMarketboard = 0x0103, // updated 4.3 SearchMarketboard = 0x0103, // updated 4.3
ReqExamineFcInfo = 0x010F, // updated 4.1
FcInfoReqHandler = 0x011A, // updated 4.2 FcInfoReqHandler = 0x011A, // updated 4.2

View file

@ -140,6 +140,16 @@ struct FFXIVIpcInitSearchInfo :
char padding[5]; char padding[5];
}; };
struct FFXIVIpcExamineSearchComment :
FFXIVIpcBasePacket< ExamineSearchComment >
{
uint32_t charId;
// packet only has 196 bytes after the charid
// likely utf8
char searchComment[195];
char padding;
};
/** /**
* Structural representation of the packet sent by the server * Structural representation of the packet sent by the server
* to display a server notice message * to display a server notice message
@ -200,6 +210,25 @@ struct FFXIVIpcLinkshellList :
} entry[8]; } entry[8];
}; };
struct FFXIVIpcExamineFreeCompanyInfo :
FFXIVIpcBasePacket< ExamineFreeCompanyInfo >
{
char unknown[0x20]; // likely fc allegiance/icon/housing info etc
uint32_t charId;
uint32_t fcTimeCreated;
char unknown2[0x10];
uint16_t unknown3;
char fcName[0x14]; // 20 char limit
uint16_t padding;
char fcTag[0x05]; // 5 char tag limit
uint16_t padding2; // null terminator?
char fcLeader[0x20]; // leader name (32 bytes)
char fcSlogan[192]; // source: https://ffxiv.gamerescape.com/wiki/Free_Company (packet cap confirms this size also)
char padding3; // null terminator?
char fcEstateProfile[20]; // todo: size needs confirmation
uint32_t padding4;
};
struct FFXIVIpcStatusEffectList : struct FFXIVIpcStatusEffectList :
FFXIVIpcBasePacket< StatusEffectList > FFXIVIpcBasePacket< StatusEffectList >
{ {
@ -950,6 +979,38 @@ struct FFXIVIpcModelEquip :
/* 003C */ uint32_t padding2; /* 003C */ uint32_t padding2;
}; };
struct FFXIVIpcExamine :
FFXIVIpcBasePacket< Examine >
{
uint8_t unkFlag1;
uint8_t unkFlag2;
char classJob;
char level;
uint16_t padding;
uint16_t titleId;
char unknown[56];
struct ItemData
{
uint32_t catalogId;
uint32_t appearanceCatalogId;
uint64_t unknown2;
uint32_t unknown3;
struct Materia
{
uint16_t materiaId;
uint16_t tier;
} materia[5];
} entries[14];
char name[32];
char padding2;
char unk3[16];
char look[26];
char padding3[5];
//uint32_t models[10];
char unknown4[270];
};
/** /**
* Structural representation of the packet sent by the server * Structural representation of the packet sent by the server
* to update a players appearance * to update a players appearance

View file

@ -60,14 +60,15 @@ Core::Network::GameConnection::GameConnection( Core::Network::HivePtr pHive,
&GameConnection::setSearchInfoHandler ); &GameConnection::setSearchInfoHandler );
setZoneHandler( ClientZoneIpcType::ReqSearchInfoHandler, "ReqSearchInfoHandler", setZoneHandler( ClientZoneIpcType::ReqSearchInfoHandler, "ReqSearchInfoHandler",
&GameConnection::reqSearchInfoHandler ); &GameConnection::reqSearchInfoHandler );
setZoneHandler( ClientZoneIpcType::ReqExamineSearchCommentHandler, "ReqExamineSearchCommentHandler",
&GameConnection::reqExamineSearchCommentHandler );
setZoneHandler( ClientZoneIpcType::BlackListHandler, "BlackListHandler", &GameConnection::blackListHandler ); setZoneHandler( ClientZoneIpcType::BlackListHandler, "BlackListHandler", &GameConnection::blackListHandler );
setZoneHandler( ClientZoneIpcType::LinkshellListHandler, "LinkshellListHandler", setZoneHandler( ClientZoneIpcType::LinkshellListHandler, "LinkshellListHandler",
&GameConnection::linkshellListHandler ); &GameConnection::linkshellListHandler );
setZoneHandler( ClientZoneIpcType::FcInfoReqHandler, "FcInfoReqHandler", &GameConnection::fcInfoReqHandler ); setZoneHandler( ClientZoneIpcType::FcInfoReqHandler, "FcInfoReqHandler", &GameConnection::fcInfoReqHandler );
setZoneHandler( ClientZoneIpcType::ReqExamineFcInfo, "ReqExamineFcInfo", &GameConnection::reqExamineFcInfo );
setZoneHandler( ClientZoneIpcType::ZoneLineHandler, "ZoneLineHandler", &GameConnection::zoneLineHandler ); setZoneHandler( ClientZoneIpcType::ZoneLineHandler, "ZoneLineHandler", &GameConnection::zoneLineHandler );
setZoneHandler( ClientZoneIpcType::ClientTrigger, "ClientTrigger", &GameConnection::clientTriggerHandler ); setZoneHandler( ClientZoneIpcType::ClientTrigger, "ClientTrigger", &GameConnection::clientTriggerHandler );

View file

@ -110,6 +110,10 @@ public:
DECLARE_HANDLER( reqSearchInfoHandler ); DECLARE_HANDLER( reqSearchInfoHandler );
DECLARE_HANDLER( reqExamineSearchCommentHandler );
DECLARE_HANDLER( reqExamineFcInfo );
DECLARE_HANDLER( updatePositionHandler ); DECLARE_HANDLER( updatePositionHandler );
DECLARE_HANDLER( chatHandler ); DECLARE_HANDLER( chatHandler );

View file

@ -27,6 +27,8 @@
#include "Action/Action.h" #include "Action/Action.h"
#include "Action/ActionTeleport.h" #include "Action/ActionTeleport.h"
#include "Inventory/Item.h"
#include "Session.h" #include "Session.h"
#include "ServerZone.h" #include "ServerZone.h"
#include "Forwards.h" #include "Forwards.h"
@ -118,6 +120,40 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
player.getCurrentAction()->setInterrupted(); player.getCurrentAction()->setInterrupted();
break; break;
} }
case ClientTriggerType::Examine:
{
uint32_t targetId = param11;
auto packet = makeZonePacket< FFXIVIpcExamine >( targetId, player.getId() );
auto pSession = g_fw.get< Core::ServerZone >()->getSession( targetId );
if( pSession )
{
auto pPlayer = pSession->getPlayer();
if( pPlayer )
{
// todo: this packet needs mapping out
strcpy( packet->data().name, pPlayer->getName().c_str() );
packet->data().classJob = static_cast< uint8_t >( pPlayer->getClass() );
packet->data().level = pPlayer->getLevel();
packet->data().unkFlag1 = 4;
packet->data().unkFlag2 = 1;
//packet->data().grandCompany = 1;
//packet->data().grandCompanyRank = 2;
memcpy( packet->data().look, pPlayer->getLookArray(), sizeof( packet->data().look ) );
for( auto i = 0; i < Common::GearSetSlot::SoulCrystal + 1; ++i)
{
auto pItem = pPlayer->getItemAt( Common::InventoryType::GearSet0, i );
if( pItem )
{
auto& entry = packet->data().entries[i];
entry.catalogId = pItem->getId();
//entry.appearanceCatalogId = pItem->getGlamourId()
// todo: glamour/materia etc.
}
}
}
}
player.queuePacket( packet );
}
case ClientTriggerType::MarkPlayer: // Mark player case ClientTriggerType::MarkPlayer: // Mark player
{ {
break; break;

View file

@ -105,6 +105,55 @@ void Core::Network::GameConnection::reqSearchInfoHandler( const Core::Network::P
queueOutPacket( searchInfoPacket ); queueOutPacket( searchInfoPacket );
} }
void Core::Network::GameConnection::reqExamineSearchCommentHandler( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
Entity::Player& player )
{
auto targetId = *reinterpret_cast< const uint32_t* >( &inPacket.data[ 0x10 ] );
auto pSession = g_fw.get< Core::ServerZone >()->getSession( targetId );
g_fw.get< Core::Logger >()->debug( std::to_string( targetId ) );
if( pSession )
{
auto pPlayer = pSession->getPlayer();
if( pPlayer )
{
// retail sends the requester's id as both (isForSelf)
auto searchInfoPacket = makeZonePacket< FFXIVIpcExamineSearchComment >( player.getId() );
searchInfoPacket->data().charId = targetId;
strcpy( searchInfoPacket->data().searchComment, pPlayer->getSearchMessage() );
player.queuePacket( searchInfoPacket );
}
}
}
void Core::Network::GameConnection::reqExamineFcInfo( const Core::Network::Packets::FFXIVARR_PACKET_RAW& inPacket,
Entity::Player& player )
{
auto targetId = *reinterpret_cast< const uint32_t* >( &inPacket.data[ 0x18 ] );
auto pSession = g_fw.get< Core::ServerZone >()->getSession( targetId );
g_fw.get< Core::Logger >()->debug( std::to_string( targetId ) );
if( pSession )
{
auto pPlayer = pSession->getPlayer();
if( pPlayer )
{
// retail sends the requester's id as both (isForSelf)
auto examineFcInfoPacket = makeZonePacket< FFXIVIpcExamineFreeCompanyInfo >( player.getId() );
examineFcInfoPacket->data().charId = targetId;
// todo: populate with fc info
player.queuePacket( examineFcInfoPacket );
}
}
}
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 )
{ {