mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-28 20:27:46 +00:00
Initializing point;
This commit is contained in:
parent
ce954b5d79
commit
63288704bb
8 changed files with 42 additions and 17 deletions
|
@ -33,7 +33,7 @@
|
||||||
#include <Social/Manager/SocialMgr.h>
|
#include <Social/Manager/SocialMgr.h>
|
||||||
#include "Social/FriendList.h"
|
#include "Social/FriendList.h"
|
||||||
|
|
||||||
#include "Script/ScriptManager.h"
|
#include "Script/ScriptMgr.h"
|
||||||
#include "Inventory/Item.h"
|
#include "Inventory/Item.h"
|
||||||
#include "Inventory/Inventory.h"
|
#include "Inventory/Inventory.h"
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <boost/make_shared.hpp>
|
#include <boost/make_shared.hpp>
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
|
#include <random>
|
||||||
|
|
||||||
#include <common/Common.h>
|
#include <common/Common.h>
|
||||||
#include <common/Version.h>
|
#include <common/Version.h>
|
||||||
|
@ -376,7 +377,7 @@ void Core::DebugCommandHandler::add( char * data, Entity::Player& player, boost:
|
||||||
{
|
{
|
||||||
Common::FFXIVARR_POSITION3 posC = player.getPos();
|
Common::FFXIVARR_POSITION3 posC = player.getPos();
|
||||||
std::mt19937 gen( rand() * 1000 );
|
std::mt19937 gen( rand() * 1000 );
|
||||||
std::uniform_int_distribution<int> dis( distCoefficient * -1, distCoefficient );
|
std::uniform_int_distribution< int > dis( distCoefficient * -1, distCoefficient );
|
||||||
|
|
||||||
posC.x += dis( gen );
|
posC.x += dis( gen );
|
||||||
posC.z += dis( gen );
|
posC.z += dis( gen );
|
||||||
|
|
|
@ -4,6 +4,12 @@
|
||||||
|
|
||||||
Core::ServerZone g_serverZone( "config/settings_zone.xml" );
|
Core::ServerZone g_serverZone( "config/settings_zone.xml" );
|
||||||
|
|
||||||
|
bool Core::Framework::initSocialGroups()
|
||||||
|
{
|
||||||
|
g_friendListMgr = Core::Social::SocialMgr< Core::Social::FriendList >();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Core::Logger& Core::Framework::getLogger()
|
Core::Logger& Core::Framework::getLogger()
|
||||||
{
|
{
|
||||||
return g_log;
|
return g_log;
|
||||||
|
@ -42,4 +48,9 @@ Core::Db::DbWorkerPool< Core::Db::CharaDbConnection >& Core::Framework::getChara
|
||||||
Core::ServerZone& Core::Framework::getServerZone()
|
Core::ServerZone& Core::Framework::getServerZone()
|
||||||
{
|
{
|
||||||
return g_serverZone;
|
return g_serverZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::Social::SocialMgr< Core::Social::FriendList > Core::Framework::getFriendsListMgr()
|
||||||
|
{
|
||||||
|
return g_friendListMgr;
|
||||||
}
|
}
|
|
@ -6,11 +6,11 @@
|
||||||
|
|
||||||
#include "Forwards.h"
|
#include "Forwards.h"
|
||||||
|
|
||||||
|
|
||||||
#include "ServerZone.h"
|
#include "ServerZone.h"
|
||||||
|
|
||||||
#include <common/Logging/Logger.h>
|
#include <common/Logging/Logger.h>
|
||||||
|
#include <common/Database/CharaDbConnection.h>
|
||||||
|
#include <common/Database/DbWorkerPool.h>
|
||||||
#include <common/Exd/ExdDataGenerated.h>
|
#include <common/Exd/ExdDataGenerated.h>
|
||||||
|
|
||||||
#include "Script/ScriptMgr.h"
|
#include "Script/ScriptMgr.h"
|
||||||
|
@ -21,8 +21,8 @@
|
||||||
|
|
||||||
#include "DebugCommand/DebugCommandHandler.h"
|
#include "DebugCommand/DebugCommandHandler.h"
|
||||||
|
|
||||||
#include <common/Database/CharaDbConnection.h>
|
#include "Social/Manager/SocialMgr.h"
|
||||||
#include <common/Database/DbWorkerPool.h>
|
|
||||||
|
|
||||||
namespace Core
|
namespace Core
|
||||||
{
|
{
|
||||||
|
@ -38,9 +38,12 @@ private:
|
||||||
TerritoryMgr g_territoryMgr;
|
TerritoryMgr g_territoryMgr;
|
||||||
LinkshellMgr g_linkshellMgr;
|
LinkshellMgr g_linkshellMgr;
|
||||||
Db::DbWorkerPool< Db::CharaDbConnection > g_charaDb;
|
Db::DbWorkerPool< Db::CharaDbConnection > g_charaDb;
|
||||||
|
Social::SocialMgr< Social::FriendList > g_friendListMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
bool initSocialGroups();
|
||||||
|
|
||||||
Logger& getLogger();
|
Logger& getLogger();
|
||||||
DebugCommandHandler& getDebugCommandHandler();
|
DebugCommandHandler& getDebugCommandHandler();
|
||||||
Scripting::ScriptMgr& getScriptMgr();
|
Scripting::ScriptMgr& getScriptMgr();
|
||||||
|
@ -50,6 +53,8 @@ public:
|
||||||
Db::DbWorkerPool< Db::CharaDbConnection >& getCharaDb();
|
Db::DbWorkerPool< Db::CharaDbConnection >& getCharaDb();
|
||||||
ServerZone& getServerZone();
|
ServerZone& getServerZone();
|
||||||
|
|
||||||
|
Social::SocialMgr< Social::FriendList > getFriendsListMgr();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -479,7 +479,7 @@ void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket
|
||||||
|
|
||||||
uint16_t i = 0;
|
uint16_t i = 0;
|
||||||
|
|
||||||
auto playerFriendsList = g_friendListMgr.findGroupById( player.getFriendsListId() );
|
auto playerFriendsList = g_framework.getFriendsListMgr().findGroupById( player.getFriendsListId() );
|
||||||
|
|
||||||
// todo: move this garbage else fucking where
|
// todo: move this garbage else fucking where
|
||||||
for ( auto member : playerFriendsList.getMembers() )
|
for ( auto member : playerFriendsList.getMembers() )
|
||||||
|
@ -488,7 +488,7 @@ void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket
|
||||||
if ( i == 10 )
|
if ( i == 10 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
g_log.debug( "aaa" + std::to_string( i ) + ": " + member.second.name );
|
g_framework.getLogger().debug( "aaa" + std::to_string( i ) + ": " + member.second.name );
|
||||||
listPacket.data().entries[i] = Core::Social::Group::generatePlayerEntry( member.second );
|
listPacket.data().entries[i] = Core::Social::Group::generatePlayerEntry( member.second );
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -539,15 +539,15 @@ void Core::Network::GameConnection::socialReqResponseHandler( const Packets::Gam
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
g_log.debug( std::to_string( static_cast<uint8_t>( action ) ) );
|
g_framework.getLogger().debug( std::to_string( static_cast<uint8_t>( action ) ) );
|
||||||
|
|
||||||
auto pSession = g_serverZone.getSession( targetId );
|
auto pSession = g_framework.getServerZone().getSession( targetId );
|
||||||
|
|
||||||
// todo: notify both inviter/invitee with 0x00CB packet
|
// todo: notify both inviter/invitee with 0x00CB packet
|
||||||
|
|
||||||
if( pSession )
|
if( pSession )
|
||||||
{
|
{
|
||||||
g_log.debug( std::to_string(static_cast<uint8_t>(action)) );
|
g_framework.getLogger().debug( std::to_string(static_cast<uint8_t>(action)) );
|
||||||
}
|
}
|
||||||
response.data().response = Common::SocialRequestResponse::Accept;
|
response.data().response = Common::SocialRequestResponse::Accept;
|
||||||
memcpy( &( response.data().name ), name.c_str(), 32 );
|
memcpy( &( response.data().name ), name.c_str(), 32 );
|
||||||
|
@ -561,7 +561,7 @@ void Core::Network::GameConnection::socialReqSendHandler( const Packets::GamePac
|
||||||
auto category = inPacket.getValAt< Common::SocialCategory >( 0x20 );
|
auto category = inPacket.getValAt< Common::SocialCategory >( 0x20 );
|
||||||
auto name = std::string( inPacket.getStringAt( 0x21 ) );
|
auto name = std::string( inPacket.getStringAt( 0x21 ) );
|
||||||
|
|
||||||
auto pSession = g_serverZone.getSession( name );
|
auto pSession = g_framework.getServerZone().getSession( name );
|
||||||
|
|
||||||
// only the requester needs the response
|
// only the requester needs the response
|
||||||
ZoneChannelPacket< FFXIVIpcSocialRequestError > response( player.getId() );
|
ZoneChannelPacket< FFXIVIpcSocialRequestError > response( player.getId() );
|
||||||
|
@ -691,7 +691,7 @@ void Core::Network::GameConnection::socialReqSendHandler( const Packets::GamePac
|
||||||
pRecipient->queuePacket( packet );
|
pRecipient->queuePacket( packet );
|
||||||
pRecipient->sendDebug( "ding ding" );
|
pRecipient->sendDebug( "ding ding" );
|
||||||
|
|
||||||
auto recipientFriendsList = g_friendListMgr.findGroupById( pRecipient->getFriendsListId() );
|
auto recipientFriendsList = g_framework.getFriendsListMgr().findGroupById( pRecipient->getFriendsListId() );
|
||||||
|
|
||||||
auto senderResultPacket = recipientFriendsList.inviteMember( player.getAsPlayer(), pRecipient, player.getId(), pRecipient->getId() );
|
auto senderResultPacket = recipientFriendsList.inviteMember( player.getAsPlayer(), pRecipient, player.getId(), pRecipient->getId() );
|
||||||
|
|
||||||
|
@ -699,7 +699,7 @@ void Core::Network::GameConnection::socialReqSendHandler( const Packets::GamePac
|
||||||
|
|
||||||
if ( recipientFriendsList.isFriendList() )
|
if ( recipientFriendsList.isFriendList() )
|
||||||
{
|
{
|
||||||
g_log.debug( "he HAA HAAA" );
|
g_framework.getLogger().debug( "he HAA HAAA" );
|
||||||
}
|
}
|
||||||
|
|
||||||
response.data().messageId = typeMessage[category];
|
response.data().messageId = typeMessage[category];
|
||||||
|
@ -708,7 +708,7 @@ void Core::Network::GameConnection::socialReqSendHandler( const Packets::GamePac
|
||||||
|
|
||||||
player.queuePacket( response );
|
player.queuePacket( response );
|
||||||
// todo: handle party, friend request
|
// todo: handle party, friend request
|
||||||
g_log.debug("sent to " + name);
|
g_framework.getLogger().debug("sent to " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPacket,
|
void Core::Network::GameConnection::chatHandler( const Packets::GamePacket& inPacket,
|
||||||
|
|
|
@ -202,6 +202,10 @@ void Core::ServerZone::run( int32_t argc, char* argv[] )
|
||||||
|
|
||||||
g_log = g_framework.getLogger();
|
g_log = g_framework.getLogger();
|
||||||
|
|
||||||
|
if ( !g_framework.initSocialGroups() )
|
||||||
|
{
|
||||||
|
g_framework.getLogger().fatal( "Unable to initialize social groups!" );
|
||||||
|
}
|
||||||
|
|
||||||
if( !loadSettings( argc, argv ) )
|
if( !loadSettings( argc, argv ) )
|
||||||
{
|
{
|
||||||
|
@ -216,8 +220,7 @@ void Core::ServerZone::run( int32_t argc, char* argv[] )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_friendListMgr = Core::Social::SocialMgr< Core::Social::FriendList >();
|
g_framework.getFriendsListMgr().findGroupById( 0 );
|
||||||
g_friendListMgr.findGroupById( 0 );
|
|
||||||
|
|
||||||
Network::HivePtr hive( new Network::Hive() );
|
Network::HivePtr hive( new Network::Hive() );
|
||||||
Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive );
|
Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive );
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "../Group.h"
|
#include "../Group.h"
|
||||||
#include "SocialMgr.h"
|
#include "SocialMgr.h"
|
||||||
|
|
||||||
|
#include "Forwards.h"
|
||||||
|
|
||||||
|
|
||||||
template< class T >
|
template< class T >
|
||||||
Core::Social::SocialMgr< T >::SocialMgr()
|
Core::Social::SocialMgr< T >::SocialMgr()
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include <sapphire_zone/Forwards.h>
|
#include <sapphire_zone/Forwards.h>
|
||||||
#include <Social/Group.h>
|
#include <Social/Group.h>
|
||||||
|
|
||||||
|
#include "Forwards.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Social {
|
namespace Social {
|
||||||
|
|
||||||
|
@ -15,6 +17,7 @@ template< class T >
|
||||||
class SocialMgr
|
class SocialMgr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SocialMgr();
|
SocialMgr();
|
||||||
virtual ~SocialMgr();
|
virtual ~SocialMgr();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue