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/FriendList.h"
|
||||
|
||||
#include "Script/ScriptManager.h"
|
||||
#include "Script/ScriptMgr.h"
|
||||
#include "Inventory/Item.h"
|
||||
#include "Inventory/Inventory.h"
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <boost/make_shared.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <cinttypes>
|
||||
#include <random>
|
||||
|
||||
#include <common/Common.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();
|
||||
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.z += dis( gen );
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
|
||||
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()
|
||||
{
|
||||
return g_log;
|
||||
|
@ -42,4 +48,9 @@ Core::Db::DbWorkerPool< Core::Db::CharaDbConnection >& Core::Framework::getChara
|
|||
Core::ServerZone& Core::Framework::getServerZone()
|
||||
{
|
||||
return g_serverZone;
|
||||
}
|
||||
|
||||
Core::Social::SocialMgr< Core::Social::FriendList > Core::Framework::getFriendsListMgr()
|
||||
{
|
||||
return g_friendListMgr;
|
||||
}
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
#include "Forwards.h"
|
||||
|
||||
|
||||
#include "ServerZone.h"
|
||||
|
||||
#include <common/Logging/Logger.h>
|
||||
|
||||
#include <common/Database/CharaDbConnection.h>
|
||||
#include <common/Database/DbWorkerPool.h>
|
||||
#include <common/Exd/ExdDataGenerated.h>
|
||||
|
||||
#include "Script/ScriptMgr.h"
|
||||
|
@ -21,8 +21,8 @@
|
|||
|
||||
#include "DebugCommand/DebugCommandHandler.h"
|
||||
|
||||
#include <common/Database/CharaDbConnection.h>
|
||||
#include <common/Database/DbWorkerPool.h>
|
||||
#include "Social/Manager/SocialMgr.h"
|
||||
|
||||
|
||||
namespace Core
|
||||
{
|
||||
|
@ -38,9 +38,12 @@ private:
|
|||
TerritoryMgr g_territoryMgr;
|
||||
LinkshellMgr g_linkshellMgr;
|
||||
Db::DbWorkerPool< Db::CharaDbConnection > g_charaDb;
|
||||
Social::SocialMgr< Social::FriendList > g_friendListMgr;
|
||||
|
||||
public:
|
||||
|
||||
bool initSocialGroups();
|
||||
|
||||
Logger& getLogger();
|
||||
DebugCommandHandler& getDebugCommandHandler();
|
||||
Scripting::ScriptMgr& getScriptMgr();
|
||||
|
@ -50,6 +53,8 @@ public:
|
|||
Db::DbWorkerPool< Db::CharaDbConnection >& getCharaDb();
|
||||
ServerZone& getServerZone();
|
||||
|
||||
Social::SocialMgr< Social::FriendList > getFriendsListMgr();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -479,7 +479,7 @@ void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket
|
|||
|
||||
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
|
||||
for ( auto member : playerFriendsList.getMembers() )
|
||||
|
@ -488,7 +488,7 @@ void Core::Network::GameConnection::socialListHandler( const Packets::GamePacket
|
|||
if ( i == 10 )
|
||||
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 );
|
||||
i++;
|
||||
}
|
||||
|
@ -539,15 +539,15 @@ void Core::Network::GameConnection::socialReqResponseHandler( const Packets::Gam
|
|||
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
|
||||
|
||||
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;
|
||||
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 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
|
||||
ZoneChannelPacket< FFXIVIpcSocialRequestError > response( player.getId() );
|
||||
|
@ -691,7 +691,7 @@ void Core::Network::GameConnection::socialReqSendHandler( const Packets::GamePac
|
|||
pRecipient->queuePacket( packet );
|
||||
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() );
|
||||
|
||||
|
@ -699,7 +699,7 @@ void Core::Network::GameConnection::socialReqSendHandler( const Packets::GamePac
|
|||
|
||||
if ( recipientFriendsList.isFriendList() )
|
||||
{
|
||||
g_log.debug( "he HAA HAAA" );
|
||||
g_framework.getLogger().debug( "he HAA HAAA" );
|
||||
}
|
||||
|
||||
response.data().messageId = typeMessage[category];
|
||||
|
@ -708,7 +708,7 @@ void Core::Network::GameConnection::socialReqSendHandler( const Packets::GamePac
|
|||
|
||||
player.queuePacket( response );
|
||||
// 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,
|
||||
|
|
|
@ -202,6 +202,10 @@ void Core::ServerZone::run( int32_t argc, char* argv[] )
|
|||
|
||||
g_log = g_framework.getLogger();
|
||||
|
||||
if ( !g_framework.initSocialGroups() )
|
||||
{
|
||||
g_framework.getLogger().fatal( "Unable to initialize social groups!" );
|
||||
}
|
||||
|
||||
if( !loadSettings( argc, argv ) )
|
||||
{
|
||||
|
@ -216,8 +220,7 @@ void Core::ServerZone::run( int32_t argc, char* argv[] )
|
|||
return;
|
||||
}
|
||||
|
||||
g_friendListMgr = Core::Social::SocialMgr< Core::Social::FriendList >();
|
||||
g_friendListMgr.findGroupById( 0 );
|
||||
g_framework.getFriendsListMgr().findGroupById( 0 );
|
||||
|
||||
Network::HivePtr hive( new Network::Hive() );
|
||||
Network::addServerToHive< Network::GameConnection >( m_ip, m_port, hive );
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "../Group.h"
|
||||
#include "SocialMgr.h"
|
||||
|
||||
#include "Forwards.h"
|
||||
|
||||
|
||||
template< class T >
|
||||
Core::Social::SocialMgr< T >::SocialMgr()
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include <sapphire_zone/Forwards.h>
|
||||
#include <Social/Group.h>
|
||||
|
||||
#include "Forwards.h"
|
||||
|
||||
namespace Core {
|
||||
namespace Social {
|
||||
|
||||
|
@ -15,6 +17,7 @@ template< class T >
|
|||
class SocialMgr
|
||||
{
|
||||
public:
|
||||
|
||||
SocialMgr();
|
||||
virtual ~SocialMgr();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue