1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-25 11:07:45 +00:00

Partial friend request/list coupling with social manager

This commit is contained in:
Maru 2017-12-07 19:38:17 -02:00
parent 28f2a91b21
commit f5ae374c31
6 changed files with 33 additions and 17 deletions

View file

@ -52,8 +52,6 @@ extern Core::ZoneMgr g_zoneMgr;
extern Core::Data::ExdData g_exdData; extern Core::Data::ExdData g_exdData;
extern Core::Scripting::ScriptManager g_scriptMgr; extern Core::Scripting::ScriptManager g_scriptMgr;
extern Core::Entity::Social::FriendListMgr g_friendListMgr;
using namespace Core::Common; 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;
@ -446,7 +444,10 @@ void Core::Entity::Player::setZone( uint32_t zoneId )
gcAffPacket.data().gcRank[2] = m_gcRank[2]; gcAffPacket.data().gcRank[2] = m_gcRank[2];
queuePacket( gcAffPacket ); queuePacket( gcAffPacket );
m_friendsList = g_friendListMgr.getPlayerFriendsList( getId() ); //todo: change this to extern, global obj
Core::Entity::Social::FriendListMgr fListMgr = {};
m_friendsList = fListMgr.getPlayerFriendsList( getId() );
m_itemLevel = getInventory()->calculateEquippedGearItemLevel(); m_itemLevel = getInventory()->calculateEquippedGearItemLevel();
sendItemLevel(); sendItemLevel();

View file

@ -53,6 +53,7 @@ Core::Network::Packets::GamePacketPtr Group::addMember( Core::Entity::PlayerPtr
member.inviterId = senderId; member.inviterId = senderId;
member.role = 0; member.role = 0;
member.contentId = recipientId; member.contentId = recipientId;
member.name = pSender->getName();
m_members.emplace( recipientId, member ); m_members.emplace( recipientId, member );
} }
else else
@ -85,17 +86,17 @@ Core::Network::Packets::Server::PlayerEntry Group::generatePlayerEntry( GroupMem
// We check if player is online. If so, we can pull more data - otherwise just name // We check if player is online. If so, we can pull more data - otherwise just name
// todo: set as offline in one of the unknown values, if session does not exist // todo: set as offline in one of the unknown values, if session does not exist
auto pSession = g_serverZone.getSession( groupMember.name ); // todo: aa i don't like this. maybe just store their ID instead of contentID??? auto pSession = g_serverZone.getSession( groupMember.contentId ); // todo: aa i don't like this. maybe just store their ID instead of contentID???
if( pSession )
{
auto pPlayer = pSession->getPlayer();
entry.bytes[2] = pPlayer->getCurrentZone()->getId();
entry.bytes[3] = 0x80; entry.bytes[3] = 0x80;
entry.bytes[4] = 0x02; entry.bytes[4] = 0x02;
entry.bytes[6] = 0x3B; entry.bytes[6] = 0x3B;
entry.bytes[11] = 0x10; entry.bytes[11] = 0x10;
if( pSession )
{
auto pPlayer = pSession->getPlayer();
entry.contentId = pPlayer->getContentId();
entry.bytes[2] = pPlayer->getCurrentZone()->getId();
entry.classJob = pPlayer->getClass(); entry.classJob = pPlayer->getClass();
entry.level = pPlayer->getLevel(); entry.level = pPlayer->getLevel();

View file

@ -11,11 +11,21 @@ extern Core::Logger g_log;
using namespace Core::Entity; using namespace Core::Entity;
Social::FriendListMgr::FriendListMgr() Core::Entity::Social::FriendListMgr::FriendListMgr()
{ {
} }
Core::Entity::Social::FriendListMgr::~FriendListMgr()
{
}
bool Social::FriendListMgr::init()
{
return true;
}
Social::FriendListPtr Social::FriendListMgr::getPlayerFriendsList( uint32_t playerId ) Social::FriendListPtr Social::FriendListMgr::getPlayerFriendsList( uint32_t playerId )
{ {
std::mt19937_64 engine( std::random_device{}( ) ); std::mt19937_64 engine( std::random_device{}( ) );

View file

@ -10,6 +10,7 @@
#include <Server_Zone/Actor/Social/FriendList.h> #include <Server_Zone/Actor/Social/FriendList.h>
#include <Server_Zone/Actor/Social/Manager/GroupMgr.h> #include <Server_Zone/Actor/Social/Manager/GroupMgr.h>
#include <Server_Zone/Forwards.h>
namespace Core { namespace Core {
namespace Entity { namespace Entity {
@ -19,6 +20,9 @@ class FriendListMgr
{ {
public: public:
FriendListMgr(); FriendListMgr();
~FriendListMgr();
bool init();
FriendListPtr getPlayerFriendsList( uint32_t playerId ); FriendListPtr getPlayerFriendsList( uint32_t playerId );

View file

@ -7,8 +7,8 @@ project(Sapphire_Zone)
file(GLOB SERVER_PUBLIC_INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} file(GLOB SERVER_PUBLIC_INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
/*.h /*.h
Actor/*.h Actor/*.h
Actor/Group/*.h Actor/Social/*.h
Actor/Group/Manager/*.h Actor/Social/Manager/*.h
Action/*.h Action/*.h
DebugCommand/*.h DebugCommand/*.h
Event/*.h Event/*.h
@ -25,8 +25,8 @@ file(GLOB SERVER_PUBLIC_INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
file(GLOB SERVER_SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} file(GLOB SERVER_SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.c* *.c*
Actor/*.c* Actor/*.c*
Actor/Group/*.c* Actor/Social/*.c*
Actor/Group/Manager/*.c* Actor/Social/Manager/*.c*
Action/*.c* Action/*.c*
DebugCommand/*.c* DebugCommand/*.c*
Event/*.c* Event/*.c*

View file

@ -454,7 +454,7 @@ void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket
ZoneChannelPacket< FFXIVIpcSocialList > listPacket( pPlayer->getId() ); ZoneChannelPacket< FFXIVIpcSocialList > listPacket( pPlayer->getId() );
listPacket.data().type = 0x0B; listPacket.data().type = 0x0B;
listPacket.data().sequence = 10; listPacket.data().sequence = count;
memset( listPacket.data().entries, 0, sizeof( listPacket.data().entries ) ); memset( listPacket.data().entries, 0, sizeof( listPacket.data().entries ) );
uint16_t i = 0; uint16_t i = 0;